freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brent (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (FREEMARKER-81) <#nt> in combination with a <@macro > directive, only keeps indentation for the first line
Date Fri, 27 Oct 2017 12:15:00 GMT

    [ https://issues.apache.org/jira/browse/FREEMARKER-81?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16222256#comment-16222256
] 

Brent edited comment on FREEMARKER-81 at 10/27/17 12:14 PM:
------------------------------------------------------------

Well, perhaps it is "supposed to work" like that, but it is illogical.

Consider that I have this template:

<#macro someStatements>
System.out.println("hello");
System.out.println("world");
</#macro>

void test() {
    <@someStatements />
}

I will receive the following result:

void test() {
System.out.println("hello");
System.out.println("world");
}

The fix to keep indentation was to use <#nt>:
void test() {
    <@someStatements /><#nt>
}

Expected result:
void test() {
    System.out.println("hello");
    System.out.println("world");
}
Actual result:
void test() {
    System.out.println("hello");
System.out.println("world");
}


was (Author: brentc):
Well, perhaps it is "supposed to work" like that, but it is illogical.

Consider that I have this template:

{{<#macro someStatements>
System.out.println("hello");
System.out.println("world");
</#macro>

void test() {
    <@someStatements />
}}}

I will receive the following result:

{{void test() {
System.out.println("hello");
System.out.println("world");
}}}

The fix to keep indentation was to use <#nt>:
{{void test() {
    <@someStatements /><#nt>
}}}

Expected result:
{{void test() {
    System.out.println("hello");
    System.out.println("world");
}}}
Actual result:
{{void test() {
    System.out.println("hello");
System.out.println("world");
}}}

> <#nt> in combination with a <@macro > directive, only keeps indentation for
the first line
> ------------------------------------------------------------------------------------------
>
>                 Key: FREEMARKER-81
>                 URL: https://issues.apache.org/jira/browse/FREEMARKER-81
>             Project: Apache Freemarker
>          Issue Type: Bug
>          Components: engine
>            Reporter: Brent
>
> <#nt> in combination with a <@macro > directive, only keeps indentation for
the first line. Multiple lines in the macro, will put every line except the first without
indentation.
> I actually propose a neater way to keep indentation of the line where <@macro>
is used, to use as baseline for the entire macro.
> See my post on StackOverflow for an example: https://stackoverflow.com/a/46973468/2686165



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message