Thanks Christoph, I'll have a read of the proposals. -----Original Message----- From: [email protected] [mailto:[email protected]] Sent: 12 January 2010 14:08 To: Velocity Users List Subject: Re: Macro calls not honouring line breaks
Velocity gobbles the end of line characters after most directives, see: http://velocity.apache.org/engine/releases/velocity-1.6.2/user-guide.htm l#VTL:_Formatting_Issues More control of the whitespace gobbling is not yet implemented, some proposals for this: http://wiki.apache.org/velocity/VelocityWhitespaceGobbling So for now you could enhance your trick using an empty variable after the macro call to avoid this EOL gobbling: #set( $empty = '' ) #macro( testMarcro ) i am a macro #end #testMacro()$empty #testMacro() Kind regards, Christoph On 2010-01-12 13:19, [email protected] wrote: > I'm experiencing a similar problem to a user in June. If a macro does > not contain a line break, then calling this macro followed by a line > break results in no line break occurring. > > Best explained via an example: > > Template: > #macro( testMarcro ) i am a macro #end > #testMacro() > #testMacro() > > Output: > i am a macro i am a macro > > Expected output: > i am a macro > i am a macro > > Could someone shed some light on this unexpected behaviour? > > Interestingly if I follow the macro call with an empty reference the > line break is preserved, although it seems to be unreliable: > > #macro( testMarcro ) i am a macro #end > #testMacro() $!variablewhichdoesntexist > #testMacro() > > Output: > i am a macro > I am a macro > > Original post: > http://old.nabble.com/Velocity-removes-a-newline-after-a-macro-call-tt23 > 827728.html#a23827728 > > --------------------------------------------------------------------- > 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]
