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 2005/01/05 15:48:41 UTC
svn commit: r124214 - in jakarta/velocity/trunk: src/java/org/apache/velocity/context src/java/org/apache/velocity/runtime/parser src/java/org/apache/velocity/runtime/parser/node test/templates test/templates/compare
Author: wglass
Date: Wed Jan 5 06:48:36 2005
New Revision: 124214
URL: http://svn.apache.org/viewcvs?view=rev&rev=124214
Log:
#stop was not working
http://issues.apache.org/bugzilla/show_bug.cgi?id=24189
Added:
jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStop.java
jakarta/velocity/trunk/test/templates/compare/stop1.cmp
jakarta/velocity/trunk/test/templates/compare/stop2.cmp
jakarta/velocity/trunk/test/templates/stop1.vm
jakarta/velocity/trunk/test/templates/stop2.vm
Modified:
jakarta/velocity/trunk/src/java/org/apache/velocity/context/InternalContextAdapterImpl.java
jakarta/velocity/trunk/src/java/org/apache/velocity/context/InternalContextBase.java
jakarta/velocity/trunk/src/java/org/apache/velocity/context/InternalHousekeepingContext.java
jakarta/velocity/trunk/src/java/org/apache/velocity/context/VMContext.java
jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java
jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jj
jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jjt
jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/ParserTokenManager.java
jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/ParserTreeConstants.java
jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTComment.java
jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTDirective.java
jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTEscape.java
jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTEscapedDirective.java
jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java
jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTText.java
jakarta/velocity/trunk/test/templates/templates.properties
Modified: jakarta/velocity/trunk/src/java/org/apache/velocity/context/InternalContextAdapterImpl.java
Url: http://svn.apache.org/viewcvs/jakarta/velocity/trunk/src/java/org/apache/velocity/context/InternalContextAdapterImpl.java?view=diff&rev=124214&p1=jakarta/velocity/trunk/src/java/org/apache/velocity/context/InternalContextAdapterImpl.java&r1=124213&p2=jakarta/velocity/trunk/src/java/org/apache/velocity/context/InternalContextAdapterImpl.java&r2=124214
==============================================================================
--- jakarta/velocity/trunk/src/java/org/apache/velocity/context/InternalContextAdapterImpl.java (original)
+++ jakarta/velocity/trunk/src/java/org/apache/velocity/context/InternalContextAdapterImpl.java Wed Jan 5 06:48:36 2005
@@ -53,7 +53,7 @@
*
*
* @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
- * @version $Id: InternalContextAdapterImpl.java,v 1.10 2004/03/19 17:13:33 dlr Exp $
+ * @version $Id$
*/
public final class InternalContextAdapterImpl implements InternalContextAdapter
{
@@ -147,6 +147,17 @@
public Resource getCurrentResource()
{
return icb.getCurrentResource();
+ }
+
+
+ public boolean getAllowRendering()
+ {
+ return icb.getAllowRendering();
+ }
+
+ public void setAllowRendering(boolean v)
+ {
+ icb.setAllowRendering(v);
}
Modified: jakarta/velocity/trunk/src/java/org/apache/velocity/context/InternalContextBase.java
Url: http://svn.apache.org/viewcvs/jakarta/velocity/trunk/src/java/org/apache/velocity/context/InternalContextBase.java?view=diff&rev=124214&p1=jakarta/velocity/trunk/src/java/org/apache/velocity/context/InternalContextBase.java&r1=124213&p2=jakarta/velocity/trunk/src/java/org/apache/velocity/context/InternalContextBase.java&r2=124214
==============================================================================
--- jakarta/velocity/trunk/src/java/org/apache/velocity/context/InternalContextBase.java (original)
+++ jakarta/velocity/trunk/src/java/org/apache/velocity/context/InternalContextBase.java Wed Jan 5 06:48:36 2005
@@ -38,7 +38,7 @@
* is derived from this.
*
* @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
- * @version $Id: InternalContextBase.java,v 1.10 2004/03/19 17:13:33 dlr Exp $
+ * @version $Id$
*/
class InternalContextBase implements InternalHousekeepingContext, InternalEventContext, Serializable
{
@@ -64,6 +64,11 @@
private Resource currentResource = null;
/**
+ * Is rendering allowed? Defaults to true, can be changed by #stop directive.
+ */
+ private boolean allowRendering = true;
+
+ /**
* set the current template name on top of stack
*
* @param s current template name
@@ -139,6 +144,18 @@
{
return currentResource;
}
+
+
+ public boolean getAllowRendering()
+ {
+ return allowRendering;
+ }
+
+ public void setAllowRendering(boolean v)
+ {
+ allowRendering = v;
+ }
+
public EventCartridge attachEventCartridge( EventCartridge ec )
{
Modified: jakarta/velocity/trunk/src/java/org/apache/velocity/context/InternalHousekeepingContext.java
Url: http://svn.apache.org/viewcvs/jakarta/velocity/trunk/src/java/org/apache/velocity/context/InternalHousekeepingContext.java?view=diff&rev=124214&p1=jakarta/velocity/trunk/src/java/org/apache/velocity/context/InternalHousekeepingContext.java&r1=124213&p2=jakarta/velocity/trunk/src/java/org/apache/velocity/context/InternalHousekeepingContext.java&r2=124214
==============================================================================
--- jakarta/velocity/trunk/src/java/org/apache/velocity/context/InternalHousekeepingContext.java (original)
+++ jakarta/velocity/trunk/src/java/org/apache/velocity/context/InternalHousekeepingContext.java Wed Jan 5 06:48:36 2005
@@ -31,7 +31,7 @@
*
* @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
* @author <a href="mailto:Christoph.Reck@dlr.de">Christoph Reck</a>
- * @version $Id: InternalHousekeepingContext.java,v 1.8 2004/03/19 17:13:33 dlr Exp $
+ * @version $Id$
*/
interface InternalHousekeepingContext
{
@@ -88,4 +88,18 @@
void setCurrentResource( Resource r );
+ /**
+ * Checks to see if rendering should be allowed. Defaults to true but will
+ * return false after a #stop directive.
+ *
+ * @return true if rendering is allowed, false if no rendering should occur
+ */
+ boolean getAllowRendering();
+
+ /**
+ * Set whether rendering is allowed. Defaults to true but is set to
+ * false after a #stop directive.
+ */
+ void setAllowRendering(boolean v);
+
}
Modified: jakarta/velocity/trunk/src/java/org/apache/velocity/context/VMContext.java
Url: http://svn.apache.org/viewcvs/jakarta/velocity/trunk/src/java/org/apache/velocity/context/VMContext.java?view=diff&rev=124214&p1=jakarta/velocity/trunk/src/java/org/apache/velocity/context/VMContext.java&r1=124213&p2=jakarta/velocity/trunk/src/java/org/apache/velocity/context/VMContext.java&r2=124214
==============================================================================
--- jakarta/velocity/trunk/src/java/org/apache/velocity/context/VMContext.java (original)
+++ jakarta/velocity/trunk/src/java/org/apache/velocity/context/VMContext.java Wed Jan 5 06:48:36 2005
@@ -37,7 +37,7 @@
* local to the vm, protecting the global context.
*
* @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
- * @version $Id: VMContext.java,v 1.11 2004/03/19 17:13:33 dlr Exp $
+ * @version $Id$
*/
public class VMContext implements InternalContextAdapter
{
@@ -265,6 +265,16 @@
public void icachePut( Object key, IntrospectionCacheData o )
{
innerContext.icachePut( key, o );
+ }
+
+ public boolean getAllowRendering()
+ {
+ return innerContext.getAllowRendering();
+ }
+
+ public void setAllowRendering(boolean v)
+ {
+ innerContext.setAllowRendering(v);
}
public EventCartridge attachEventCartridge( EventCartridge ec )
Modified: jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java
Url: http://svn.apache.org/viewcvs/jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java?view=diff&rev=124214&p1=jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java&r1=124213&p2=jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java&r2=124214
==============================================================================
--- jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java (original)
+++ jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/Parser.java Wed Jan 5 06:48:36 2005
@@ -1702,7 +1702,17 @@
* purposes.
*/
final public void StopStatement() throws ParseException {
- jj_consume_token(STOP_DIRECTIVE);
+ /*@bgen(jjtree) #Stop( 0) */
+ ASTStop jjtn000 = new ASTStop(this, JJTSTOP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+ try {
+ jj_consume_token(STOP_DIRECTIVE);
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, 0);
+ }
+ }
}
/* -----------------------------------------------------------------------
@@ -2437,6 +2447,12 @@
return retval;
}
+ final private boolean jj_3R_40() {
+ if (jj_scan_token(WHITESPACE)) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+ return false;
+ }
+
final private boolean jj_3R_43() {
if (jj_scan_token(NUMBER_LITERAL)) return true;
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
@@ -2918,14 +2934,14 @@
return false;
}
- final private boolean jj_3R_22() {
- if (jj_3R_20()) return true;
+ final private boolean jj_3R_53() {
+ if (jj_scan_token(WHITESPACE)) return true;
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
return false;
}
- final private boolean jj_3R_53() {
- if (jj_scan_token(WHITESPACE)) return true;
+ final private boolean jj_3R_22() {
+ if (jj_3R_20()) return true;
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
return false;
}
@@ -3236,12 +3252,6 @@
return false;
}
- final private boolean jj_3R_40() {
- if (jj_scan_token(WHITESPACE)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
public ParserTokenManager token_source;
public Token token, jj_nt;
private int jj_ntk;
@@ -3251,9 +3261,23 @@
private boolean jj_semLA;
private int jj_gen;
final private int[] jj_la1 = new int[57];
- final private int[] jj_la1_0 = {0x9f81b00,0x0,0x9f81b00,0x1c00000,0x8000000,0x30000042,0x4000000,0x4000000,0x4000000,0x9f81b00,0x8,0x4000000,0x8,0x3c000042,0x4000000,0x0,0x4000000,0x4000000,0x0,0x4000000,0x4000000,0x8000000,0x30000042,0x4000000,0x8,0x3c000042,0x0,0x0,0x0,0x8300300,0x4000000,0x9f81b00,0x0,0x0,0x0,0x9f81b00,0x4000000,0x9f81b00,0x4000000,0x4000000,0x40000000,0x0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x80000000,0x0,0x0,0x4000000,0x3c000142,0x4000000,0x8000000,0x30000142,0x4000000,};
- final private int[] jj_la1_1 = {0x78948000,0x48000,0x70900000,0x0,0x28900000,0x0,0x0,0x0,0x0,0x78948000,0x0,0x0,0x0,0x28100000,0x0,0x28100000,0x0,0x0,0x28100000,0x0,0x0,0x0,0x28100000,0x0,0x0,0x28100000,0x8000000,0x8000000,0x28000000,0x70100000,0x0,0x78948000,0x10000,0x10000,0x20000,0x78948000,0x0,0x78948000,0x0,0x0,0x0,0x20,0x10,0xc00,0xc00,0x3c0,0x3c0,0x1,0x1,0xe,0xe,0x0,0x28100000,0x0,0x28100000,0x0,0x0,};
- final private int[] jj_la1_2 = {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
+ static private int[] jj_la1_0;
+ static private int[] jj_la1_1;
+ static private int[] jj_la1_2;
+ static {
+ jj_la1_0();
+ jj_la1_1();
+ jj_la1_2();
+ }
+ private static void jj_la1_0() {
+ jj_la1_0 = new int[] {0x9f81b00,0x0,0x9f81b00,0x1c00000,0x8000000,0x30000042,0x4000000,0x4000000,0x4000000,0x9f81b00,0x8,0x4000000,0x8,0x3c000042,0x4000000,0x0,0x4000000,0x4000000,0x0,0x4000000,0x4000000,0x8000000,0x30000042,0x4000000,0x8,0x3c000042,0x0,0x0,0x0,0x8300300,0x4000000,0x9f81b00,0x0,0x0,0x0,0x9f81b00,0x4000000,0x9f81b00,0x4000000,0x4000000,0x40000000,0x0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x80000000,0x0,0x0,0x4000000,0x3c000142,0x4000000,0x8000000,0x30000142,0x4000000,};
+ }
+ private static void jj_la1_1() {
+ jj_la1_1 = new int[] {0x78948000,0x48000,0x70900000,0x0,0x28900000,0x0,0x0,0x0,0x0,0x78948000,0x0,0x0,0x0,0x28100000,0x0,0x28100000,0x0,0x0,0x28100000,0x0,0x0,0x0,0x28100000,0x0,0x0,0x28100000,0x8000000,0x8000000,0x28000000,0x70100000,0x0,0x78948000,0x10000,0x10000,0x20000,0x78948000,0x0,0x78948000,0x0,0x0,0x0,0x20,0x10,0xc00,0xc00,0x3c0,0x3c0,0x1,0x1,0xe,0xe,0x0,0x28100000,0x0,0x28100000,0x0,0x0,};
+ }
+ private static void jj_la1_2() {
+ jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
+ }
final private JJCalls[] jj_2_rtns = new JJCalls[12];
private boolean jj_rescan = false;
private int jj_gc = 0;
@@ -3379,8 +3403,8 @@
jj_expentry[i] = jj_lasttokens[i];
}
boolean exists = false;
- for (java.util.Enumeration enumeration = jj_expentries.elements(); enumeration.hasMoreElements();) {
- int[] oldentry = (int[])(enumeration.nextElement());
+ for (java.util.Enumeration enum = jj_expentries.elements(); enum.hasMoreElements();) {
+ int[] oldentry = (int[])(enum.nextElement());
if (oldentry.length == jj_expentry.length) {
exists = true;
for (int i = 0; i < jj_expentry.length; i++) {
@@ -3397,7 +3421,7 @@
}
}
- final public ParseException generateParseException() {
+ public ParseException generateParseException() {
jj_expentries.removeAllElements();
boolean[] la1tokens = new boolean[65];
for (int i = 0; i < 65; i++) {
Modified: jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jj
Url: http://svn.apache.org/viewcvs/jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jj?view=diff&rev=124214&p1=jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jj&r1=124213&p2=jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jj&r2=124214
==============================================================================
--- jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jj (original)
+++ jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jj Wed Jan 5 06:48:36 2005
@@ -1,4 +1,4 @@
-/*@bgen(jjtree) Generated By:JJTree: Do not edit this line. Parser.jj */
+/*@bgen(jjtree) Generated By:JJTree: Do not edit this line. parser.jj */
/*@egen*//*
* The Apache Software License, Version 1.1
*
@@ -54,19 +54,19 @@
*/
/*
- * NOTE: Please see documentation at bottom of this file (placed
- * there because it's tiring to always have to page past it... :)
+ * NOTE : please see documentation at bottom of this file. (It was placed there its tiring
+ * to always have to page past it... :)
*/
options
-{
+{
/**
* The parser must be non-static in order for the
* above option to work, otherwise the parser value
* is passed in as null, which isn't all the useful ;)
*/
- STATIC=false;
+ STATIC=false;
/**
* Declare that we are accepting unicode input and
@@ -899,8 +899,8 @@
| <STOP_DIRECTIVE: "stop">
{
- matchedToken.kind = EOF;
- fileDepth = 0;
+ inDirective = false;
+ stateStackPop();
}
}
@@ -2079,9 +2079,21 @@
* is useful for end-user debugging
* purposes.
*/
-void StopStatement() : {}
-{
- <STOP_DIRECTIVE>
+void StopStatement() : {/*@bgen(jjtree) #Stop( 0) */
+ ASTStop jjtn000 = new ASTStop(this, JJTSTOP);
+ boolean jjtc000 = true;
+ jjtree.openNodeScope(jjtn000);
+/*@egen*/}
+{/*@bgen(jjtree) #Stop( 0) */
+ try {
+/*@egen*/
+ <STOP_DIRECTIVE>/*@bgen(jjtree)*/
+ } finally {
+ if (jjtc000) {
+ jjtree.closeNodeScope(jjtn000, 0);
+ }
+ }
+/*@egen*/
}
/* -----------------------------------------------------------------------
Modified: jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jjt
Url: http://svn.apache.org/viewcvs/jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jjt?view=diff&rev=124214&p1=jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jjt&r1=124213&p2=jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jjt&r2=124214
==============================================================================
--- jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jjt (original)
+++ jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/Parser.jjt Wed Jan 5 06:48:36 2005
@@ -920,8 +920,8 @@
| <STOP_DIRECTIVE: "stop">
{
- matchedToken.kind = EOF;
- fileDepth = 0;
+ inDirective = false;
+ stateStackPop();
}
}
@@ -1566,7 +1566,7 @@
* is useful for end-user debugging
* purposes.
*/
-void StopStatement() #void: {}
+void StopStatement() #Stop(0): {}
{
<STOP_DIRECTIVE>
}
Modified: jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/ParserTokenManager.java
Url: http://svn.apache.org/viewcvs/jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/ParserTokenManager.java?view=diff&rev=124214&p1=jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/ParserTokenManager.java&r1=124213&p2=jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/ParserTokenManager.java&r2=124214
==============================================================================
--- jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/ParserTokenManager.java (original)
+++ jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/ParserTokenManager.java Wed Jan 5 06:48:36 2005
@@ -303,7 +303,7 @@
private final int jjMoveStringLiteralDfa2_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(0, old0);
+ return jjStartNfa_0(0, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(1, active0);
@@ -323,7 +323,7 @@
private final int jjMoveStringLiteralDfa3_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(1, old0);
+ return jjStartNfa_0(1, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(2, active0);
@@ -345,7 +345,7 @@
private final int jjMoveStringLiteralDfa4_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(2, old0);
+ return jjStartNfa_0(2, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(3, active0);
@@ -1207,7 +1207,7 @@
private final int jjMoveStringLiteralDfa2_4(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
- return jjStartNfa_4(0, old0);
+ return jjStartNfa_4(0, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_4(1, active0);
@@ -1227,7 +1227,7 @@
private final int jjMoveStringLiteralDfa3_4(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
- return jjStartNfa_4(1, old0);
+ return jjStartNfa_4(1, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_4(2, active0);
@@ -1249,7 +1249,7 @@
private final int jjMoveStringLiteralDfa4_4(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
- return jjStartNfa_4(2, old0);
+ return jjStartNfa_4(2, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_4(3, active0);
@@ -1267,7 +1267,7 @@
private final int jjMoveStringLiteralDfa5_4(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
- return jjStartNfa_4(3, old0);
+ return jjStartNfa_4(3, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_4(4, active0);
@@ -2398,7 +2398,7 @@
private final int jjMoveStringLiteralDfa2_5(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
- return jjStartNfa_5(0, old0);
+ return jjStartNfa_5(0, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_5(1, active0);
@@ -2418,7 +2418,7 @@
private final int jjMoveStringLiteralDfa3_5(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
- return jjStartNfa_5(1, old0);
+ return jjStartNfa_5(1, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_5(2, active0);
@@ -2440,7 +2440,7 @@
private final int jjMoveStringLiteralDfa4_5(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
- return jjStartNfa_5(2, old0);
+ return jjStartNfa_5(2, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_5(3, active0);
@@ -2742,7 +2742,7 @@
private final int jjMoveStringLiteralDfa2_1(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
- return jjStartNfa_1(0, old0);
+ return jjStartNfa_1(0, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_1(1, active0);
@@ -2762,7 +2762,7 @@
private final int jjMoveStringLiteralDfa3_1(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
- return jjStartNfa_1(1, old0);
+ return jjStartNfa_1(1, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_1(2, active0);
@@ -2784,7 +2784,7 @@
private final int jjMoveStringLiteralDfa4_1(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
- return jjStartNfa_1(2, old0);
+ return jjStartNfa_1(2, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_1(3, active0);
@@ -3193,7 +3193,7 @@
private final int jjMoveStringLiteralDfa2_2(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
- return jjStartNfa_2(0, old0);
+ return jjStartNfa_2(0, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_2(1, active0);
@@ -3213,7 +3213,7 @@
private final int jjMoveStringLiteralDfa3_2(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
- return jjStartNfa_2(1, old0);
+ return jjStartNfa_2(1, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_2(2, active0);
@@ -3235,7 +3235,7 @@
private final int jjMoveStringLiteralDfa4_2(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
- return jjStartNfa_2(2, old0);
+ return jjStartNfa_2(2, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_2(3, active0);
@@ -3415,12 +3415,12 @@
}
}
static final int[] jjnextStates = {
- 22, 23, 26, 11, 12, 13, 1, 2, 4, 11, 16, 12, 13, 19, 20, 24,
- 25, 57, 58, 59, 60, 71, 73, 68, 69, 65, 66, 14, 15, 17, 19, 20,
- 61, 62, 5, 6, 7, 8, 9, 10, 24, 25, 27, 18, 19, 21, 9, 10,
- 11, 12, 22, 29, 13, 14, 2, 3, 18, 19, 20, 21, 22, 23, 8, 9,
- 10, 11, 12, 13, 17, 18, 21, 6, 7, 8, 6, 11, 7, 8, 14, 15,
- 29, 30, 31, 32, 9, 10, 12, 14, 15, 33, 34,
+ 22, 23, 26, 11, 12, 13, 1, 2, 4, 11, 16, 12, 13, 19, 20, 24,
+ 25, 57, 58, 59, 60, 71, 73, 68, 69, 65, 66, 14, 15, 17, 19, 20,
+ 61, 62, 5, 6, 7, 8, 9, 10, 24, 25, 27, 18, 19, 21, 9, 10,
+ 11, 12, 22, 29, 13, 14, 2, 3, 18, 19, 20, 21, 22, 23, 8, 9,
+ 10, 11, 12, 13, 17, 18, 21, 6, 7, 8, 6, 11, 7, 8, 14, 15,
+ 29, 30, 31, 32, 9, 10, 12, 14, 15, 33, 34,
};
private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2)
{
@@ -3428,47 +3428,47 @@
{
case 0:
return ((jjbitVec2[i2] & l2) != 0L);
- default :
+ default :
if ((jjbitVec0[i1] & l1) != 0L)
return true;
return false;
}
}
public static final String[] jjstrLiteralImages = {
-null, null, null, null, null, null, null, null, null, null, null, null, null,
-null, null, null, null, null, null, null, null, null, null, null, null, null, null,
-null, null, null, null, null, null, null, null, null, null, null, null, null, null,
-null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+null, null, null, null, null, null, null, null, null, null, null, null, null,
+null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, };
public static final String[] lexStateNames = {
- "DIRECTIVE",
- "REFMOD2",
- "REFMODIFIER",
- "DEFAULT",
- "PRE_DIRECTIVE",
- "REFERENCE",
- "IN_MULTI_LINE_COMMENT",
- "IN_FORMAL_COMMENT",
- "IN_SINGLE_LINE_COMMENT",
+ "DIRECTIVE",
+ "REFMOD2",
+ "REFMODIFIER",
+ "DEFAULT",
+ "PRE_DIRECTIVE",
+ "REFERENCE",
+ "IN_MULTI_LINE_COMMENT",
+ "IN_FORMAL_COMMENT",
+ "IN_SINGLE_LINE_COMMENT",
};
public static final int[] jjnewLexState = {
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
static final long[] jjtoToken = {
- 0x7897fffffdf81fffL, 0x0L,
+ 0x7897fffffdf81fffL, 0x0L,
};
static final long[] jjtoSkip = {
- 0x8000000002000000L, 0x1L,
+ 0x8000000002000000L, 0x1L,
};
static final long[] jjtoSpecial = {
- 0x8000000000000000L, 0x1L,
+ 0x8000000000000000L, 0x1L,
};
static final long[] jjtoMore = {
- 0x7e000L, 0x0L,
+ 0x7e000L, 0x0L,
};
-private CharStream input_stream;
+protected CharStream input_stream;
private final int[] jjrounds = new int[74];
private final int[] jjstateSet = new int[148];
StringBuffer image;
@@ -3511,7 +3511,7 @@
curLexState = lexState;
}
-private final Token jjFillToken()
+protected Token jjFillToken()
{
Token t = Token.newToken(jjmatchedKind);
t.kind = jjmatchedKind;
@@ -3531,7 +3531,7 @@
int jjmatchedPos;
int jjmatchedKind;
-public final Token getNextToken()
+public Token getNextToken()
{
int kind;
Token specialToken = null;
@@ -3540,13 +3540,13 @@
EOFLoop :
for (;;)
- {
- try
- {
+ {
+ try
+ {
curChar = input_stream.BeginToken();
- }
+ }
catch(java.io.IOException e)
- {
+ {
jjmatchedKind = 0;
matchedToken = jjFillToken();
matchedToken.specialToken = specialToken;
@@ -3660,7 +3660,7 @@
}
SkipLexicalActions(matchedToken);
}
- else
+ else
SkipLexicalActions(null);
if (jjnewLexState[jjmatchedKind] != -1)
curLexState = jjnewLexState[jjmatchedKind];
@@ -3701,7 +3701,7 @@
}
}
-final void SkipLexicalActions(Token matchedToken)
+void SkipLexicalActions(Token matchedToken)
{
switch(jjmatchedKind)
{
@@ -3739,7 +3739,7 @@
break;
}
}
-final void MoreLexicalActions()
+void MoreLexicalActions()
{
jjimageLen += (lengthOfMatch = jjmatchedPos + 1);
switch(jjmatchedKind)
@@ -3870,11 +3870,11 @@
SwitchTo(PRE_DIRECTIVE);
}
break;
- default :
+ default :
break;
}
}
-final void TokenLexicalActions(Token matchedToken)
+void TokenLexicalActions(Token matchedToken)
{
switch(jjmatchedKind)
{
@@ -4037,8 +4037,8 @@
image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
else
image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
- matchedToken.kind = EOF;
- fileDepth = 0;
+ inDirective = false;
+ stateStackPop();
break;
case 52 :
if (image == null)
@@ -4086,7 +4086,7 @@
image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
stateStackPop();
break;
- default :
+ default :
break;
}
}
Modified: jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/ParserTreeConstants.java
Url: http://svn.apache.org/viewcvs/jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/ParserTreeConstants.java?view=diff&rev=124214&p1=jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/ParserTreeConstants.java&r1=124213&p2=jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/ParserTreeConstants.java&r2=124214
==============================================================================
--- jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/ParserTreeConstants.java (original)
+++ jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/ParserTreeConstants.java Wed Jan 5 06:48:36 2005
@@ -27,22 +27,23 @@
public int JJTELSESTATEMENT = 20;
public int JJTELSEIFSTATEMENT = 21;
public int JJTSETDIRECTIVE = 22;
- public int JJTEXPRESSION = 23;
- public int JJTASSIGNMENT = 24;
- public int JJTORNODE = 25;
- public int JJTANDNODE = 26;
- public int JJTEQNODE = 27;
- public int JJTNENODE = 28;
- public int JJTLTNODE = 29;
- public int JJTGTNODE = 30;
- public int JJTLENODE = 31;
- public int JJTGENODE = 32;
- public int JJTADDNODE = 33;
- public int JJTSUBTRACTNODE = 34;
- public int JJTMULNODE = 35;
- public int JJTDIVNODE = 36;
- public int JJTMODNODE = 37;
- public int JJTNOTNODE = 38;
+ public int JJTSTOP = 23;
+ public int JJTEXPRESSION = 24;
+ public int JJTASSIGNMENT = 25;
+ public int JJTORNODE = 26;
+ public int JJTANDNODE = 27;
+ public int JJTEQNODE = 28;
+ public int JJTNENODE = 29;
+ public int JJTLTNODE = 30;
+ public int JJTGTNODE = 31;
+ public int JJTLENODE = 32;
+ public int JJTGENODE = 33;
+ public int JJTADDNODE = 34;
+ public int JJTSUBTRACTNODE = 35;
+ public int JJTMULNODE = 36;
+ public int JJTDIVNODE = 37;
+ public int JJTMODNODE = 38;
+ public int JJTNOTNODE = 39;
public String[] jjtNodeName = {
@@ -69,6 +70,7 @@
"ElseStatement",
"ElseIfStatement",
"SetDirective",
+ "Stop",
"Expression",
"Assignment",
"OrNode",
Modified: jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTComment.java
Url: http://svn.apache.org/viewcvs/jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTComment.java?view=diff&rev=124214&p1=jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTComment.java&r1=124213&p2=jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTComment.java&r2=124214
==============================================================================
--- jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTComment.java (original)
+++ jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTComment.java Wed Jan 5 06:48:36 2005
@@ -30,7 +30,7 @@
* Represents all comments...
*
* @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
- * @version $Id: ASTComment.java,v 1.7 2004/03/19 17:13:36 dlr Exp $
+ * @version $Id$
*/
public class ASTComment extends SimpleNode
{
@@ -80,6 +80,8 @@
public boolean render( InternalContextAdapter context, Writer writer)
throws IOException, MethodInvocationException, ParseErrorException, ResourceNotFoundException
{
+
+ if (context.getAllowRendering())
writer.write(carr);
return true;
Modified: jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTDirective.java
Url: http://svn.apache.org/viewcvs/jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTDirective.java?view=diff&rev=124214&p1=jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTDirective.java&r1=124213&p2=jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTDirective.java&r2=124214
==============================================================================
--- jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTDirective.java (original)
+++ jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTDirective.java Wed Jan 5 06:48:36 2005
@@ -39,7 +39,7 @@
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
* @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
* @author <a href="mailto:kav@kav.dk">Kasper Nielsen</a>
- * @version $Id: ASTDirective.java,v 1.25 2004/03/20 03:35:51 dlr Exp $
+ * @version $Id$
*/
public class ASTDirective extends SimpleNode
{
@@ -117,8 +117,10 @@
}
else
{
+ if (context.getAllowRendering()) {
writer.write( "#");
writer.write( directiveName );
+ }
}
return true;
Modified: jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTEscape.java
Url: http://svn.apache.org/viewcvs/jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTEscape.java?view=diff&rev=124214&p1=jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTEscape.java&r1=124213&p2=jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTEscape.java&r2=124214
==============================================================================
--- jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTEscape.java (original)
+++ jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTEscape.java Wed Jan 5 06:48:36 2005
@@ -30,7 +30,7 @@
* what controls the generation of this class.
*
* @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
- * @version $Id: ASTEscape.java,v 1.8 2004/03/19 17:13:36 dlr Exp $
+ * @version $Id$
*/
public class ASTEscape extends SimpleNode
{
@@ -63,7 +63,9 @@
public boolean render( InternalContextAdapter context, Writer writer)
throws IOException
{
+ if (context.getAllowRendering()) {
writer.write(ctext);
+ }
return true;
}
}
Modified: jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTEscapedDirective.java
Url: http://svn.apache.org/viewcvs/jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTEscapedDirective.java?view=diff&rev=124214&p1=jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTEscapedDirective.java&r1=124213&p2=jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTEscapedDirective.java&r2=124214
==============================================================================
--- jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTEscapedDirective.java (original)
+++ jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTEscapedDirective.java Wed Jan 5 06:48:36 2005
@@ -30,7 +30,7 @@
* what controls the generation of this class.
*
* @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
- * @version $Id: ASTEscapedDirective.java,v 1.5 2004/03/19 17:13:36 dlr Exp $
+ * @version $Id$
*/
public class ASTEscapedDirective extends SimpleNode
{
@@ -54,7 +54,9 @@
public boolean render(InternalContextAdapter context, Writer writer)
throws IOException
{
+ if (context.getAllowRendering()) {
writer.write(getFirstToken().image);
+ }
return true;
}
Modified: jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java
Url: http://svn.apache.org/viewcvs/jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java?view=diff&rev=124214&p1=jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java&r1=124213&p2=jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java&r2=124214
==============================================================================
--- jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java (original)
+++ jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java Wed Jan 5 06:48:36 2005
@@ -213,7 +213,10 @@
if (referenceType == RUNT)
{
+ if (context.getAllowRendering()) {
writer.write(rootString);
+ }
+
return true;
}
@@ -229,14 +232,18 @@
{
if (value == null)
{
- writer.write(escPrefix);
- writer.write("\\");
- writer.write(nullString);
+ if (context.getAllowRendering()) {
+ writer.write(escPrefix);
+ writer.write("\\");
+ writer.write(nullString);
+ }
}
else
{
- writer.write(escPrefix);
- writer.write(nullString);
+ if (context.getAllowRendering()) {
+ writer.write(escPrefix);
+ writer.write(nullString);
+ }
}
return true;
@@ -265,10 +272,12 @@
* write prefix twice, because it's schmoo, so the \ don't escape each other...
*/
- writer.write(escPrefix);
- writer.write(escPrefix);
- writer.write(morePrefix);
- writer.write(nullString);
+ if (context.getAllowRendering()) {
+ writer.write(escPrefix);
+ writer.write(escPrefix);
+ writer.write(morePrefix);
+ writer.write(nullString);
+ }
if (referenceType != QUIET_REFERENCE
&& rsvc.getBoolean(RuntimeConstants.RUNTIME_LOG_REFERENCE_LOG_INVALID,
@@ -286,9 +295,11 @@
* non-null processing
*/
- writer.write(escPrefix);
- writer.write(morePrefix);
- writer.write(value.toString());
+ if (context.getAllowRendering()) {
+ writer.write(escPrefix);
+ writer.write(morePrefix);
+ writer.write(value.toString());
+ }
return true;
}
Added: jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStop.java
Url: http://svn.apache.org/viewcvs/jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStop.java?view=auto&rev=124214
==============================================================================
--- (empty file)
+++ jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTStop.java Wed Jan 5 06:48:36 2005
@@ -0,0 +1,67 @@
+package org.apache.velocity.runtime.parser.node;
+
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.Writer;
+import java.io.IOException;
+
+import org.apache.velocity.context.InternalContextAdapter;
+import org.apache.velocity.runtime.parser.Parser;
+
+import org.apache.velocity.exception.MethodInvocationException;
+import org.apache.velocity.exception.ParseErrorException;
+import org.apache.velocity.exception.ResourceNotFoundException;
+
+/**
+ * This class is responsible for handling the #stop directive
+ *
+ * Please look at the Parser.jjt file which is
+ * what controls the generation of this class.
+ *
+ * @author <a href="mailto:wglass@forio.com">Will Glass-Husain</a>
+ * @version $Id: ASTStop.java,v 1.10 2004/03/19 17:13:36 dlr Exp $
+ */
+public class ASTStop extends SimpleNode
+{
+ public ASTStop(int id)
+ {
+ super(id);
+ }
+
+ public ASTStop(Parser p, int id)
+ {
+ super(p, id);
+ }
+
+ /** Accept the visitor. **/
+ public Object jjtAccept(ParserVisitor visitor, Object data)
+ {
+ return visitor.visit(this, data);
+ }
+
+ /**
+ * Do not output anything, just shut off the rendering.
+ */
+ public boolean render( InternalContextAdapter context, Writer writer)
+ throws IOException, MethodInvocationException, ParseErrorException, ResourceNotFoundException
+ {
+ context.setAllowRendering(false);
+
+ return true;
+ }
+}
+
Modified: jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTText.java
Url: http://svn.apache.org/viewcvs/jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTText.java?view=diff&rev=124214&p1=jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTText.java&r1=124213&p2=jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTText.java&r2=124214
==============================================================================
--- jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTText.java (original)
+++ jakarta/velocity/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTText.java Wed Jan 5 06:48:36 2005
@@ -58,7 +58,9 @@
public boolean render( InternalContextAdapter context, Writer writer)
throws IOException
{
+ if (context.getAllowRendering()) {
writer.write(ctext);
+ }
return true;
}
}
Added: jakarta/velocity/trunk/test/templates/compare/stop1.cmp
Url: http://svn.apache.org/viewcvs/jakarta/velocity/trunk/test/templates/compare/stop1.cmp?view=auto&rev=124214
==============================================================================
--- (empty file)
+++ jakarta/velocity/trunk/test/templates/compare/stop1.cmp Wed Jan 5 06:48:36 2005
@@ -0,0 +1,2 @@
+This page checks the stop directive in the main body
+
Added: jakarta/velocity/trunk/test/templates/compare/stop2.cmp
Url: http://svn.apache.org/viewcvs/jakarta/velocity/trunk/test/templates/compare/stop2.cmp?view=auto&rev=124214
==============================================================================
--- (empty file)
+++ jakarta/velocity/trunk/test/templates/compare/stop2.cmp Wed Jan 5 06:48:36 2005
@@ -0,0 +1,6 @@
+This page checks the stop directive inside an if statement
+
+
+this should render
+
+
Added: jakarta/velocity/trunk/test/templates/stop1.vm
Url: http://svn.apache.org/viewcvs/jakarta/velocity/trunk/test/templates/stop1.vm?view=auto&rev=124214
==============================================================================
--- (empty file)
+++ jakarta/velocity/trunk/test/templates/stop1.vm Wed Jan 5 06:48:36 2005
@@ -0,0 +1,19 @@
+This page checks the stop directive in the main body
+
+#stop
+
+this should not render
+
+check reference
+#set($a = 10)
+$a
+
+check method call
+$a.toString()
+
+check escaped directive
+\#if
+
+check escaped reference
+\$a
+
Added: jakarta/velocity/trunk/test/templates/stop2.vm
Url: http://svn.apache.org/viewcvs/jakarta/velocity/trunk/test/templates/stop2.vm?view=auto&rev=124214
==============================================================================
--- (empty file)
+++ jakarta/velocity/trunk/test/templates/stop2.vm Wed Jan 5 06:48:36 2005
@@ -0,0 +1,31 @@
+This page checks the stop directive inside an if statement
+
+#if(false)
+
+ #stop
+
+#end
+
+this should render
+
+#if(true)
+
+#stop
+
+#end
+
+this should not render
+
+check reference
+#set($a = 10)
+$a
+
+check method call
+$a.toString()
+
+check escaped directive
+\#if
+
+check escaped reference
+\$a
+
Modified: jakarta/velocity/trunk/test/templates/templates.properties
Url: http://svn.apache.org/viewcvs/jakarta/velocity/trunk/test/templates/templates.properties?view=diff&rev=124214&p1=jakarta/velocity/trunk/test/templates/templates.properties&r1=124213&p2=jakarta/velocity/trunk/test/templates/templates.properties&r2=124214
==============================================================================
--- jakarta/velocity/trunk/test/templates/templates.properties (original)
+++ jakarta/velocity/trunk/test/templates/templates.properties Wed Jan 5 06:48:36 2005
@@ -42,3 +42,5 @@
test.template.40 = newline
test.template.41 = logical2
test.template.42 = string
+test.template.43 = stop1
+test.template.44 = stop2
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org