You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by jv...@locus.apache.org on 2000/12/20 08:11:49 UTC

cvs commit: jakarta-velocity/src/java/org/apache/velocity/convert WebMacro.java

jvanzyl     00/12/19 23:11:49

  Modified:    src/java/org/apache/velocity/convert WebMacro.java
  Log:
  - adding javadoc
  
  Revision  Changes    Path
  1.4       +25 -0     jakarta-velocity/src/java/org/apache/velocity/convert/WebMacro.java
  
  Index: WebMacro.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/convert/WebMacro.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- WebMacro.java	2000/10/17 09:33:46	1.3
  +++ WebMacro.java	2000/12/20 07:11:49	1.4
  @@ -67,8 +67,13 @@
    */
   public class WebMacro
   {
  +    /** Name of the original webmacro template */
       protected String orignalTemplate;
  +    
  +    /** Regular expression tool */
       protected Perl5Util perl;
  +    
  +    /** Path separator property */
       protected String pathSeparator = File.separator;
       
       protected final static String VM_EXT = ".vm";
  @@ -114,6 +119,10 @@
           ".vm"
       };
       
  +    /**
  +     * Iterate through the set of find/replace regexes
  +     * that will convert a given WM template to a VM template
  +     */
       public void convert(String args[])
       {
           if (args.length < 1)
  @@ -145,6 +154,10 @@
               writeTemplate(args[0], "", "");
       }
   
  +    /**
  +     * Write out the converted template to the given named file
  +     * and base directory.
  +     */
       private boolean writeTemplate(String file, String basedir, String newBasedir)
       {
           if (file.indexOf(WM_EXT) < 0)
  @@ -194,6 +207,9 @@
           return true;
       }
   
  +    /**
  +     * Simple extension conversion of .wm to .vm
  +     */
       private String convertName(String name)
       {
           if (name.indexOf(WM_EXT) > 0)
  @@ -202,12 +218,18 @@
               return name;
       }
   
  +    /**
  +     * How to use this little puppy :-)
  +     */
       public void usage()
       {
           System.err.println("Usage: convert-wm <template>.wm | directory");
           System.exit(1);
       }
   
  +    /**
  +     * Apply find/replace regexes to our WM template
  +     */
       public String convertTemplate(String template)
       {
           orignalTemplate = StringUtils.fileContentsToString(template);
  @@ -221,6 +243,9 @@
           return orignalTemplate;
       }
   
  +    /**
  +     * Main hook for the conversion process.
  +     */
       public static void main(String[] args)
       {
           WebMacro converter = new WebMacro();