[
https://issues.apache.org/jira/browse/FREEMARKER-82?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224235#comment-16224235
]
Daniel Dekany edited comment on FREEMARKER-82 at 10/29/17 10:45 PM:
--------------------------------------------------------------------
I think the dynamic indentation thing is possible to implement in FreeMarker 2
(but it won't be easy). Though devil is in the details, that is, I might
realize something blocker if I try to implement it. The plans for FreeMarker 3
(which I have referred to earlier as something that doesn't work with plain
{{Writer}}-s) addresses other issues as well, like when line breaks that you
actually wanted are lost (dangerous, as no whitespace at all VS a line break is
very often significant even in HTML), which FreeMarker 2 may won't be able to
do (I'm still looking into it though).
I don't see the need for new directives just for this. By default the
indentation of a directive would specify the indentation of the content printed
by it. Only when that's not desirable one could add {{#lt}}, though that's
where tricky things starts, as that can mean a negative indentation compared to
its context...
Another thing... please update the problem description. What you are asking for
is dynamic indentation. FreeMarker 2.3 (vs 2.2) has nothing to do with this, as
FreeMarker has never supported dynamic indentation.
was (Author: ddekany):
I think the dynamic indentation thing is possible to implement in FreeMarker 2
(but it won't be easy). Though devil is in the details, that is, I might
realize something blocker if I try to implement it. The plans for FreeMarker 3
(which I have referred to earlier as something that doesn't work with plain
{{Writer}}-s) addresses other issues as well, like when line breaks that you
actually wanted are lost (dangerous, as no whitespace at all VS a line break is
very often significant even in HTML), which FreeMarker 2 may won't be able to
do (I'm still looking into it though).
I don't see the need for new directives just for this. By default the
indentation of a directive would specify the indentation of the content printed
by it. Only when that's not desirable one could add {{#nt}}, though that's
where tricky things starts, as that can mean a negative indentation compared to
its context...
Another thing... please update the problem description. What you are asking for
is dynamic indentation. FreeMarker 2.3 (vs 2.2) has nothing to do with this, as
FreeMarker has never supported dynamic indentation.
> A new whitespace tag to indicate the baseline indentation for <@macro> and
> includes.
> ------------------------------------------------------------------------------------
>
> Key: FREEMARKER-82
> URL: https://issues.apache.org/jira/browse/FREEMARKER-82
> Project: Apache Freemarker
> Issue Type: Wish
> Components: engine
> Reporter: Brent
>
> Sometimes, perhaps most of the times, it is useful to split up small pieces
> of my template into macros or otherwise other templates to include.
> However, since V2.3, lines containing only FTL tags get trimmed. This is
> annoying because I may want to include a macro or another template, with the
> current indentation of where I call it.
> This brings me to my next point, as shown in [my answer on
> StackOverflow|https://stackoverflow.com/a/46973468/2686165], it is possible
> to keep this indentation with <#nt>, but this only works for the first line
> of the macro (see SO answer at the bottom).
> So I propose an easy way to say "use the current indentation of the line, as
> a base of all the indentation for my macro or included template.
> Any indentation inside the included template, or the macro would be relative.
> If one wished to break the relative indentation for a line inside their
> included template or macro, another tag should be foreseen to indicate that.
> New tags:
> * To indicate an indentation base for templates/macros
> * To indicate that a line inside the included template/macro must not use the
> indentation base (so you can put lines that don't follow the indentation,
> perhaps <#t> already provides this functionality)
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)