velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From by...@apache.org
Subject svn commit: r739324 - /velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/RuntimeMacro.java
Date Fri, 30 Jan 2009 16:35:45 GMT
Author: byron
Date: Fri Jan 30 16:35:45 2009
New Revision: 739324

URL: http://svn.apache.org/viewvc?rev=739324&view=rev
Log:
Apple strict mode setting to block macro definitions

Modified:
    velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/RuntimeMacro.java

Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/RuntimeMacro.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/RuntimeMacro.java?rev=739324&r1=739323&r2=739324&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/RuntimeMacro.java
(original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/RuntimeMacro.java
Fri Jan 30 16:35:45 2009
@@ -131,11 +131,14 @@
         this.node = node;
         
         /**
-         * Only check for strictRef setting if this really looks like a macro,
+         * Apply strictRef setting only if this really looks like a macro,
          * so strict mode doesn't balk at things like #E0E0E0 in a template.
+         * compare with ")" is a simple #foo() style macro, comparing to
+         * "#end" is a block style macro. We use starts with because the token
+         * may end with '\n'
          */
         Token t = node.getLastToken();
-        if (t.image.charAt(0) == ')')
+        if (t.image.startsWith(")") || t.image.startsWith("#end"))
         {
             strictRef = rsvc.getBoolean(RuntimeConstants.RUNTIME_REFERENCES_STRICT, false);
         }



Mime
View raw message