"powers that be"? anyway, we know it. just can't change it in the current version track or lots and lots of peoples templates will change unexpectedly. we'll do a less backwards compatible change in the future and bring this in.
WILL On 11/22/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Hi, For now you can use "#*[ \t]*\n?[ \t]**#" and "##\n" constructs to mask out whitespace. The whitespace gobbling re-engineering should happen in a later version. My Idea would be to cleanup the parser and let it not gobble any whitespace, but place them in special whitespace AST nodes. Then we could have pluggable AST post processing functions: - current way - do the right thing (tm) - NOP :) Christoph Will Glass-Husain wrote: > Hi Marc, > > Thanks for the input. There seems to be widespread dissatisfaction > with the status quo on this issue, yet it's a tricky issue to change > while maintaining backwards compatibility (involves fundamental > changes to the parser). Currently thinking about this as part of some > future 2.0 version. > > Incidentally, the best solution for leaving out extra newlines is to > put "##" at the end of each line. This kills the newline. Doesn't > help the issue of extra spaces before indented statements, though. > > WILL > > On 11/21/06, Marc Novakowski <[EMAIL PROTECTED]> wrote: >> I've been meaning to add my vote to this page, so I finally did it. >> +1 for gobbling structured templates. >> >> We use velocity for most of the "backstage" area at Pandora. It's >> made development so much easier! However, the final HTML looks quite >> messy due to all of the extra whitespace introduced by the velocity >> templates. >> >> Marc >> >> On 14-Nov-06, at 8:18 AM, [EMAIL PROTECTED] wrote: >> >> > See the Wiki on this issue: >> > http://wiki.apache.org/jakarta-velocity/VelocityWhitespaceGobbling >> > >> > Please add your opinion (well thought out) or vote for one of the >> > presented approaches. >> > >> > Cheers, >> > Christoph >> > >> > Paul Loy wrote: >> >> I would be very interested in a solution to this problem. From a code >> >> layout point of view this would be an important feature. Consider: >> >> >> >> <div> >> >> " >> >> >> >> #if ($somevar) >> >> $somevar >> >> #else >> >> nothing here >> >> #end >> >> >> >> " >> >> </div> >> >> >> >> This nicely formatted code makes it easy to see what's going on >> >> but will >> >> make the html render with spaces in it like so (if $somevar is >> >> false or >> >> null): >> >> >> >> ' nothing here ' >> >> >> >> Now this is a silly example and in this case it would be much >> >> easier to >> >> simply do this to eliminate the problem: >> >> >> >> >> >> <div> >> >> >> >> #if ($somevar) >> >> "$somevar" >> >> #else >> >> "nothing here" >> >> #end >> >> >> >> </div> >> >> >> >> but in more complex examples you'd either have a great amount of >> >> duplicated HTML, which makes it bad to maintain and update, or you'd >> >> have to make unreadable code (everything on one line with no white >> >> spaces). >> >> >> >> I converted an old nasty taglibbed jsp into velocity and although I >> >> cleaned up the html (removing 20+ unnecessary nested tables) the >> >> filesize of the velocity version was actually slightly bigger than >> >> the >> >> old version because of all the whitespace. >> >> >> >> So... I would very much like velocity to perhaps remove whitespace >> >> between a directive (i.e. a # statement) and any other code. >> >> >> >> Paul. >> >> >> >> Timothy Stone wrote: >> >>> List, >> >>> >> >>> We noticed in #parse'ing an .vm file, excess whitespace, or >> >>> linefeeds, >> >>> are appearing in our templates after merge. >> >>> >> >>> For example, where a '+' indicates a line feed or carriage return: >> >>> >> >>> [mystyles.vm] >> >>> + >> >>> #set( $foo = "Copyright (c)") >> >>> + >> >>> #set( $bar = "2006" ) >> >>> + >> >>> >> >>> >> >>> [myemail.txt] >> >>> #parse("mystyles.vm") >> >>> + >> >>> Dear bloated warthog, >> >>> blah >> >>> + >> >>> blah >> >>> + >> >>> blah >> >>> + >> >>> Regards, >> >>> Man in Black >> >>> + >> >>> ${foo} ${bar} >> >>> >> >>> [The final output] >> >>> + >> >>> + >> >>> + >> >>> + >> >>> Dear bloated warthog, >> >>> blah >> >>> + >> >>> blah >> >>> + >> >>> blah >> >>> + >> >>> Regards, >> >>> Man in Black >> >>> + >> >>> Copyright (c) 2006 >> >>> >> >>> Can these extra lines be managed in some way? >> >>> >> >>> Thanks, >> >>> Tim >> >>> >> >>> >> >>> >> >>> -------------------------------------------------------------------- >> >>> - >> >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >>> For additional commands, e-mail: [EMAIL PROTECTED] >> >>> >> >> >> >> >> > >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > For additional commands, e-mail: [EMAIL PROTECTED] >> > >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
