dlr         01/05/07 22:39:36

  Modified:    src/java/org/apache/velocity/convert WebMacro.java
  Log:
  Handled case where $ is escaped in conjunction with explicit WM
  statement terminator (such as \$foo).  Thanks to Manoj Kasichainula
  <[EMAIL PROTECTED]> and Kevin Maples <[EMAIL PROTECTED]> for the regex
  help.
  
  Revision  Changes    Path
  1.12      +4 -5      
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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- WebMacro.java     2001/05/08 03:38:53     1.11
  +++ WebMacro.java     2001/05/08 05:39:36     1.12
  @@ -70,7 +70,8 @@
    * this class.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
  - * @version $Id: WebMacro.java,v 1.11 2001/05/08 03:38:53 dlr Exp $ 
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Daniel Rall</a>
  + * @version $Id: WebMacro.java,v 1.12 2001/05/08 05:39:36 dlr Exp $ 
    */
   public class WebMacro
   {
  @@ -90,8 +91,6 @@
        * The regexes to use for substition. The regexes come
        * in pairs. The first is the string to match, the
        * second is the substitution to make.
  -     * <p>
  -     * TODO: Handle case where $ is escaped, such as <code>\$foo</code>
        */
       protected String[] res =
       {
  @@ -143,8 +142,8 @@
           "${l$1}",
   
           // Convert explicitly terminated WM statements to VTL syntax.
  -        "\\$([^; \\t]+);",
  -        "${$1}",
  +        "(^|[^\\\\])\\$([\\w]+);",
  +        "$1${$2}",
   
           // Change extensions when seen.
           "\\.wm",
  
  
  

Reply via email to