Hi,
I threw a few short notes up onto the Velocity Wiki. It's a neat idea. Maybe we can take "how to" type emails and get them up there. I threw my notes on how to revise Velocity syntax onto Tim's VelocityArchitecture page:
http://nagoya.apache.org/wiki/apachewiki.cgi?VelocityArchitecture
Cool!
I also wrote an Anakia style sheet which does an acceptable job of translating xdoc format to Wiki (not perfect, though). It's at:
http://nagoya.apache.org/wiki/apachewiki.cgi?AnakiaWikiStyleSheet
WILL
P.S. By the way, Wiki is very sensitive to whitespace/carriage returns. I'm now a big fan of adding better whitespace handling to Velocity. Getting rid of excess carriage returns made the Wiki stylesheet almost unreadable in part!
+1
Note that with my proposal to whitespace handling, the below cascade would not produce *any* whitespace. Only the desired whitespaces within the called macros would show in the output - this is what I meant in other threads on this subject by "what most people would expect"!
It would be much nicer to avoid needing the extra empty line in many of these macros and then just write straight ahead:
#macro( parsecontent $children )
#foreach( $items in $children )
#if( $items.getName().equalsIgnoreCase("img") )
#image($items)
#elseif( $items.getName().equalsIgnoreCase("section") )
#section($items)
#elseif( $items.getName().equalsIgnoreCase("subsection") )
#subsection($items)
#elseif( $items.getName().equalsIgnoreCase("source") )
#source($items)
#elseif( $items.getName().equalsIgnoreCase("table") )
#table( $items )
#elseif( $items.getName().equalsIgnoreCase("P") )
#paragraph($items)
#elseif( $items.getName().equalsIgnoreCase("UL") )
#unorderedlist($items)
#elseif ($items.getName().equalsIgnoreCase("OL") )
#orderedlist($items)
#elseif( $items.getName().equalsIgnoreCase("DIV") )
#parsecontent($items.content)
#elseif( $items.getName().equalsIgnoreCase("FONT") )
#font($items)
#elseif( $items.getName().equalsIgnoreCase("A") )
#link($items)
#elseif( $items.getName().equalsIgnoreCase("I") )
#text( "<I>#parsecontent($items.content)</I>" )
#elseif( $items.getName().equalsIgnoreCase("EM") )
#text( "<EM>#parsecontent($items.content)</EM>" )
#elseif( $items.content )
#parsecontent($items.content)
#else
#text( "$items.Text" )
#end
#end
#endAlso see that I added a #text macro call to the <I> and <EM> tag
handling, otherwise my proposed handling would have emitted the
verbatim leanding spaces. Using the string interpolation avoids
any extra space, which is prettyer than writing:
...
#elseif( $items.getName().equalsIgnoreCase("I") )#*
*##parsecontent($items.content)</I>##
#elseif( $items.getName().equalsIgnoreCase("EM") )#*
*#...By adding a global variable $indent and prefixing the lines apropiately, adding #set( $indent = "$indent " ) before recursive calls, and #set( $indent = $indent.substring(2) ) after these, you would even obtain prefectly nested&beautiful output!
_______________________________________ Forio Business Simulations Will Glass-Husain
[EMAIL PROTECTED] www.forio.com
-- :) Christoph Reck
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
