freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ondra Žižka (JIRA) <>
Subject [jira] [Created] (FREEMARKER-20) A directive to print a new line
Date Tue, 19 Apr 2016 19:09:25 GMT
Ondra Žižka created FREEMARKER-20:

             Summary: A directive to print a new line
                 Key: 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.
            <#if dep.classifier??><classifier>${dep.classifier}</classifier></#if>

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:
            <#if dep.classifier??><classifier>${dep.classifier}</classifier><#br></#if><#rt>

So that's the request. It can also be anything what helps me achieve that.

Until then, I have to do:
            <#if dep.classifier??>
Which I don't like because it makes the templates way longer.

            <#if dep.classifier??><classifier>${dep.classifier}</classifier>
            </#if><#if dep.classifier??><classifier>${dep.classifier}</classifier>
Which I don't like because it's messy.

This message was sent by Atlassian JIRA

View raw message