jvanzyl     00/10/16 23:12:05

  Modified:    src/java/org/apache/velocity/convert WebMacro.java
  Log:
  - parse -> include and if/else conversion.
  
  Revision  Changes    Path
  1.2       +18 -7     
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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WebMacro.java     2000/10/17 05:55:11     1.1
  +++ WebMacro.java     2000/10/17 06:12:03     1.2
  @@ -75,26 +75,37 @@
            */
           String[] res = 
           {
  -            // Remove all #begin statements
  +            // Remove all #begin statements.
               "#begin\\n", 
               "",
               
  -            // Convert WM style #foreach to Velocity #foreach
  -            "#foreach\\s+(\\$\\w+)\\s+in\\s+(\\$\\w+)",
  -            "#foreach ($1 in $2)",
  -        
               // Remove the "{" for the start of block directives,
               // Velocity doesn't use them.
               "(#\\w+\\s+.*)\\n\\s*\\{",
               "$1",
  -            
  +
               // Change the "}" to #end. Have to get more
               // sophisticated here. Will assume either {}
               // and no javascript, or #begin/#end with the
               // possibility of javascript.
               "}",
  -            "#end"
  +            "#end",
  +            
  +            // Convert WM style if/else to Velocity style.
  +            "#end.*\\n\\s*(#else)",
  +            "$1",
  +            
  +            // Convert WM style #foreach to Velocity #foreach.
  +            "#foreach\\s+(\\$\\w+)\\s+in\\s+(\\$\\w+)",
  +            "#foreach ($1 in $2)",
  +        
  +            // Change parse to include.
  +            "#parse",
  +            "#include",
               
  +            // Change extensions when seen.
  +            "\\.wm",
  +            ".vm"
           };
   
           if (args.length < 1)
  
  
  

Reply via email to