You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by by...@apache.org on 2009/01/30 17:35:45 UTC

svn commit: r739324 - /velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/RuntimeMacro.java

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);
         }