[ 
https://issues.apache.org/jira/browse/FREEMARKER-20?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ondra Žižka updated FREEMARKER-20:
----------------------------------
    Summary: Some single-line solution to avoid empty lines   (was: A directive 
to print a new line)

> Some single-line solution to avoid empty lines 
> -----------------------------------------------
>
>                 Key: FREEMARKER-20
>                 URL: https://issues.apache.org/jira/browse/FREEMARKER-20
>             Project: Apache Freemarker
>          Issue Type: Bug
>          Components: engine
>    Affects Versions: 2.3.23
>            Reporter: Ondra Žižka
>
> I'd like to be able to generate a line conditionally, with 1 line of template 
> source code.
> {code}
>             <#if 
> dep.classifier??><classifier>${dep.classifier}</classifier></#if>
> {code}
> I haven't found a way. {{#t}} and {{#rt}} and {{#lt}} apply at compile time, 
> so they don't care about the condition. So they strip even if the content is 
> there, which I don't want.
> I could do this:
> {code}
>             <#if 
> dep.classifier??><classifier>${dep.classifier}</classifier><#br></#if><#rt>
> {code}
> So that's the request. It can also be anything what helps me achieve that.
> Until then, I have to do:
> {code}
>             <#if dep.classifier??>
>             <classifier>${dep.classifier}</classifier>
>             </#if>
> {code}
> Which I don't like because it makes the templates way longer.
> Or
> {code}
>             <#if dep.classifier??><classifier>${dep.classifier}</classifier>
>             </#if><#if 
> dep.classifier??><classifier>${dep.classifier}</classifier>
>             </#if>
>             ...
> {code}
> Which I don't like because it's messy.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to