velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Colson" <tcol...@cisco.com>
Subject RE: requesting some visual improvment to parsing output
Date Tue, 27 Nov 2001 15:45:36 GMT
With apologies to Christoph as I can't recall the exact details of his
previous proposal (and I'm too lazy/busy to search right now), I'd like to
just mention an alternative used in another system that I thought worked ok.
This isn't meant to be a recommendation or proposal - just one more way it
could be done. ;-)

Newlines/spaces were included in the parsed template output.
(If you typed it, the engine expected that meant you wanted it.)

For sections where extra whitespace is not desired (for example, a chunk of
commands like in Christoph's dump.vm) a directive is inserted to turn off
extraneous output.

Pseudo Example: space.vm
--
<pre>
     This line
     has  #if($foo)$foo#end
     important whitespace.
</pre>
#space_off
## Stuff happens here and we want to gobble all whitespace
  #if( $type.startsWith("java.lang.") )
     #if( $type == "java.lang.String" )
         #set( $out = "String Thingy" )
         #out ("Thing is of type $out.<BR>")
     #end
  #end
#space_on
<PRE>  $type   =$out</PRE>
#space_off
etc...
--
Note how an explicit output directive also exists so that chunks of
formatted code can still print output.

As I said, this is just a different option - not an endorsement.

Timo
BTW - didn't want to tell above, lest some of you might ignore on principle,
but the 'system' was Cold Fusion. ;-)


--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message