views:

75

answers:

2

I'm trying out FreeMarker, not for a web application but to generate text within a desktop application. I'd like to get the text without any linefeeds, however it always appends a linefeed. For example, this would produce "blah blah\n"

<#if docType=1>
blah blah
<#if docType=2>
more blah
<#/if>

Any ideas? Bunching it all into one line works, but is horrible. Thanks.

+1  A: 

See perhaps White-space handling, ftl and compress directives. But you can't suppress all linefeeds.

Another solution : filter the output, and replace \n by " ".

Istao
Thanks - actually I've found you can compress all line feeds. <@compress single_line=true> </@compress>
Will
A: 

I would also take a look at t,lt, and rt directives.

Using your example,

<#if docType=1>
blah blah <#t>
<#if docType=2>
more blah<#t> 
<#/if>

Should produce blah blah more blah on a single line

gregcase