You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by wg...@apache.org on 2006/03/15 01:43:12 UTC
svn commit: r385942 - in /jakarta/velocity/engine/trunk:
src/java/org/apache/velocity/runtime/directive/Parse.java
test/templates/compare/stop3.cmp test/templates/stop3-include.vm
test/templates/stop3.vm test/templates/templates.properties
Author: wglass
Date: Tue Mar 14 16:43:10 2006
New Revision: 385942
URL: http://svn.apache.org/viewcvs?rev=385942&view=rev
Log:
#stop now works when in a template loaded with #parse. VELOCITY-432. Thanks Klemen Zagar
Added:
jakarta/velocity/engine/trunk/test/templates/compare/stop3.cmp
jakarta/velocity/engine/trunk/test/templates/stop3-include.vm
jakarta/velocity/engine/trunk/test/templates/stop3.vm
Modified:
jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Parse.java
jakarta/velocity/engine/trunk/test/templates/templates.properties
Modified: jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Parse.java
URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Parse.java?rev=385942&r1=385941&r2=385942&view=diff
==============================================================================
--- jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Parse.java (original)
+++ jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Parse.java Tue Mar 14 16:43:10 2006
@@ -80,6 +80,15 @@
throws IOException, ResourceNotFoundException, ParseErrorException,
MethodInvocationException
{
+ /*
+ * if rendering is no longer allowed (after a stop), we can safely
+ * skip execution of all the parse directives.
+ */
+ if(!context.getAllowRendering())
+ {
+ return true;
+ }
+
/*
* did we get an argument?
*/
Added: jakarta/velocity/engine/trunk/test/templates/compare/stop3.cmp
URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/test/templates/compare/stop3.cmp?rev=385942&view=auto
==============================================================================
--- jakarta/velocity/engine/trunk/test/templates/compare/stop3.cmp (added)
+++ jakarta/velocity/engine/trunk/test/templates/compare/stop3.cmp Tue Mar 14 16:43:10 2006
@@ -0,0 +1,4 @@
+This test checks the stop directive when included from a parse directive.
+
+Foo is: stop3-include.vm
+A line from stop3-include.vm
Added: jakarta/velocity/engine/trunk/test/templates/stop3-include.vm
URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/test/templates/stop3-include.vm?rev=385942&view=auto
==============================================================================
--- jakarta/velocity/engine/trunk/test/templates/stop3-include.vm (added)
+++ jakarta/velocity/engine/trunk/test/templates/stop3-include.vm Tue Mar 14 16:43:10 2006
@@ -0,0 +1,3 @@
+A line from stop3-include.vm
+#stop
+This line should not be seen.
Added: jakarta/velocity/engine/trunk/test/templates/stop3.vm
URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/test/templates/stop3.vm?rev=385942&view=auto
==============================================================================
--- jakarta/velocity/engine/trunk/test/templates/stop3.vm (added)
+++ jakarta/velocity/engine/trunk/test/templates/stop3.vm Tue Mar 14 16:43:10 2006
@@ -0,0 +1,8 @@
+This test checks the stop directive when included from a parse directive.
+
+#set($foo = "stop3-include.vm")
+Foo is: $foo
+#parse("$foo")
+Since the template issued a stop, this line should not be visible.
+#parse("$foo")
+
Modified: jakarta/velocity/engine/trunk/test/templates/templates.properties
URL: http://svn.apache.org/viewcvs/jakarta/velocity/engine/trunk/test/templates/templates.properties?rev=385942&r1=385941&r2=385942&view=diff
==============================================================================
--- jakarta/velocity/engine/trunk/test/templates/templates.properties (original)
+++ jakarta/velocity/engine/trunk/test/templates/templates.properties Tue Mar 14 16:43:10 2006
@@ -48,3 +48,4 @@
test.template.46 = curly-directive
test.template.47 = comment-eof
test.template.48 = commas
+test.template.49 = stop3
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org