velocity-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject cvs commit: jakarta-velocity/src/java/org/apache/velocity/texen/ant TexenTask.java
Date Fri, 23 Mar 2001 18:10:05 GMT
jvanzyl     01/03/23 10:10:04

  Modified:    src/java/org/apache/velocity/texen/ant TexenTask.java
  Log:
  - adding some more default objects to the context, for now just the
    date. all the placement of objects in the initial context will be
    moved into the ant task and taken out of the generator class.
  
  Revision  Changes    Path
  1.21      +26 -2     jakarta-velocity/src/java/org/apache/velocity/texen/ant/TexenTask.java
  
  Index: TexenTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/texen/ant/TexenTask.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- TexenTask.java	2001/03/23 17:35:36	1.20
  +++ TexenTask.java	2001/03/23 18:10:03	1.21
  @@ -54,6 +54,7 @@
    * <http://www.apache.org/>.
    */
   
  +import java.util.Date;
   import java.util.Hashtable;
   import java.util.Iterator;
   import java.util.Map;
  @@ -77,7 +78,7 @@
    * An ant task for generating output by using Velocity
    *
    * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
  - * @version $Id: TexenTask.java,v 1.20 2001/03/23 17:35:36 jvanzyl Exp $
  + * @version $Id: TexenTask.java,v 1.21 2001/03/23 18:10:03 jvanzyl Exp $
    */
   
   public class TexenTask extends Task
  @@ -333,9 +334,17 @@
                * be placed in the init context here and
                * not in the generator class itself.
                */
  -            
               Context c = initControlContext();
               
  +            /*
  +             * Everything in the generator class should be
  +             * pulled out and placed in here. What the generator
  +             * class does can probably be added to the Velocity
  +             * class and the generator class can probably
  +             * be removed all together.
  +             */
  +            populateInitialContext(c);
  +            
               /* 
                * Feed all the options into the initial
                * control context so they are available
  @@ -422,5 +431,20 @@
           {
               e.printStackTrace();
           }
  +    }
  +
  +    /**
  +     * Place some useful object in the initial context.
  +     *
  +     * @param Context initial context
  +     */
  +    protected void populateInitialContext(Context context)
  +    {
  +        /*
  +         * Place the current date in the context. Hmm,
  +         * this should probably be standard and moved
  +         * into the Texen task proper.
  +         */
  +        context.put("now", new Date().toString());
       }
   }
  
  
  

Mime
View raw message