DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG� RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=33590>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND� INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=33590 ------- Additional Comments From [EMAIL PROTECTED] 2005-02-15 19:38 ------- (In reply to comment #1) > To fix this, you won't need to change the Parser.* code, just change > Literal.java. You'll want to run a debugger and see what the children are > for > node. My guess is that this line: > > literalText = node.jjtGetChild(0).literal(); > > needs to loop through all the children and concatenate the text instead of > just getting the text for the first node. This doesn't seem to work. I added the loop you suggest as follows (with some debugging statements): StringBuffer literalTextBuffer = new StringBuffer(); for (int i = 0; i < node.jjtGetNumChildren(); i++) { literalTextBuffer.append(node.jjtGetChild(i).literal()); System.out.println("literalTextBuffer=["+literalTextBuffer+"]"); } literalText = literalTextBuffer.toString(); System.out.println("literalText=["+literalText+"]"); I also updated the literal.vm test files to check if the change works. I added a line "#!/bin/sh" (a line containing a single "#" followed by non-alpha text) near the end of the #literal/#end block. What I can see when I run the test is that there is only one child node. The one child node contains the entire block of text from #literal to #end (not including #literal/#end), and the "#" in front of "!/bin/sh" has alredy been removed. [java] Adding TemplateTestCase : settest [java] ...............................literalTextBuffer=[ [java] #foreach ($woogie in $boogie) [java] nothing will happen to $woogie [java] #end [java] #if($skin) [java] $!data.setLayoutTemplate($!skin.getLayout()) [java] $!page.setCss($!skin.getCss()) [java] #end [java] !/bin/sh [java] ] [java] literalText=[ [java] #foreach ($woogie in $boogie) [java] nothing will happen to $woogie [java] #end [java] #if($skin) [java] $!data.setLayoutTemplate($!skin.getLayout()) [java] $!page.setCss($!skin.getCss()) [java] #end [java] !/bin/sh [java] ] [java] F........ [java] Time: 1.758 [java] There was 1 failure: [java] 1) Literal(org.apache.velocity.test.TemplateTestCase)junit.framework.AssertionFailedError: Processed template did not match expected output [java] at org.apache.velocity.test.TemplateTestCase.runTest(TemplateTestCase.java:192) -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
