That's very clever. Thanks for sharing it.
This type of approach would probably help a lot of users - We should probably add it to the docs.
WILL
----- Original Message ----- From: "Barrie Treloar" <[EMAIL PROTECTED]>
To: <velocity-user@jakarta.apache.org>
Sent: Sunday, February 06, 2005 3:44 PM
Subject: Semi-workaround for the Whitespace gobbling problem
To avoid having to collapse your macros into an unreadable mess you can use the below hack to work around this.
Use the Velocity line comment syntax "##" to terminate the text that will be inserted, this will mean that newlines are no longer added.
The whitespace after the #if directive seems to be ignored so you can write constructs like this:
#macro( testMacro ) #if ( <some condition> ) This output will not have any leading whitespace, nor trailing whitespace because the line is terminated via the line comment## #else Without the line comment, this line has an extra new line which wrecks your template. #end #end
Enjoy Bae
--------------------------------------------------------------------- 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]