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

Daniel Dekany resolved FREEMARKER-83.
-------------------------------------
       Resolution: Implemented
    Fix Version/s: 2.3.28-incubating

{{.caller_template_name}} is implemented now, so you can write something like 
{{<#macro m>I was called from: ${.caller_template_name}</#macro>}}.

Also, if the {{incompatible_improvements}} configuration setting is at least 
2.3.28, the glitch with {{.current_template_name}} you have reported goes away.

> Introduce new special variable "outer_template_name" beside 
> "main_template_name"
> --------------------------------------------------------------------------------
>
>                 Key: FREEMARKER-83
>                 URL: https://issues.apache.org/jira/browse/FREEMARKER-83
>             Project: Apache Freemarker
>          Issue Type: Improvement
>          Components: engine
>    Affects Versions: 2.3.27-incubating
>            Reporter: Yanming Zhou
>            Priority: Major
>             Fix For: 2.3.28-incubating
>
>
> for example, a.ftl include b.ftl, b.ftl include c.ftl
> || ||current_template_name||outer_template_name||main_template_name||
> |a.ftl|a.ftl|null|a.ftl|
> |b.ftl|b.ftl|a.ftl|a.ftl|
> |c.ftl|c.ftl|b.ftl|a.ftl|
> I need such feature to resolve relative path like <#include> directive.
> BTW:
> .current_template_name is lazy evaluation, is this designed or bug
> {code:title=b.ftl}
> <#function templateName value>
> <#return value/>
> </#function>
> {code}
> {code:title=a.ftl}
> <#include "b.ftl">
> ${templateName(.current_template_name)}
> {code}
> it will print "b.ftl" not "a.ftl", workaround:
> {code:title=a.ftl}
> <#include "b.ftl">
> <#assign current_template_name=.current_template_name>
> ${templateName(current_template_name)}
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to