You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Matthias Keller <ma...@ergon.ch> on 2008/12/16 13:44:14 UTC

Removed linebreak after macro calling

Hi

I've defined a macro purely for convenience to avoid long method calls 
inside my template. It looks like this:

#getProperty('name')
#getProperty('function')
#getProperty('department')

Since this is plaintext (not html), whitespaces do matter, but the 
result is like this:

namefunctiondepartment

instead of

name
function
department

To fix this I have to insert an extra empty line between every call.... 
is there another way to do that? It looks really awful in the template 
to have so many empty lines

Thanks

Matt

-- 
matthias.keller@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
______________________________________________________________
e r g o n    smart people - smart software



Re: Removed linebreak after macro calling

Posted by Nathan Bubna <nb...@gmail.com>.
Can't you insert the extra line in the macro body itself?  If not, you
can always do something like:

context.put("n", "\n");

and then

#getProperty('name')$n

or if you are using VelocityTools, the EscapeTool has a getN() method:

#getProperty('name')$esc.n

On Tue, Dec 16, 2008 at 4:44 AM, Matthias Keller
<ma...@ergon.ch> wrote:
> Hi
>
> I've defined a macro purely for convenience to avoid long method calls
> inside my template. It looks like this:
>
> #getProperty('name')
> #getProperty('function')
> #getProperty('department')
>
> Since this is plaintext (not html), whitespaces do matter, but the result is
> like this:
>
> namefunctiondepartment
>
> instead of
>
> name
> function
> department
>
> To fix this I have to insert an extra empty line between every call.... is
> there another way to do that? It looks really awful in the template to have
> so many empty lines
>
> Thanks
>
> Matt
>
> --
> matthias.keller@ergon.ch  +41 44 268 83 98
> Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
> http://www.ergon.ch
> ______________________________________________________________
> e r g o n    smart people - smart software
>
>
>

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