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

Josh Wang updated FREEMARKER-72:
--------------------------------
    Description: 
Four Files:

*p1.ftl*

{code:java}
<#assign id="p1"><#include "macro.ftl">
{code}

*p2.ftl*

{code:java}
<#assign id="p2"><#include "macro.ftl">
{code}

*macro.ftl*

{code:java}
<#macro showId>${id}</#macro>
{code}

*index.ftl*

{code:java}
<#import "p1.ftl" as p1><@p1.showId /><#-- @showId == p1 -->
<#import "p2.ftl" as p2><@p2.showId /><#-- @showId == p2 -->
<@p1.showId /><#-- Why @showId == p2 ??? -->
{code}

First call <@p1.showId /> show the right result. But after call <@p2.showId />, 
if you call <@p1.showId /> again, the result is wrong.

  was:
Four Files:

*p1.ftl*

{code:java}
<#assign id="p1">
<#include "macro.ftl">
{code}

*p2.ftl*

{code:java}
<#assign id="p2">
<#include "macro.ftl">
{code}

*macro.ftl*

{code:java}
<#macro showId>${.vars.id}</#macro>
{code}

*index.ftl*

{code:java}
<#import "p1.ftl" as p1><@p1.showId /><#-- @showId == p1 -->
<#import "p2.ftl" as p2><@p2.showId /><#-- @showId == p2 -->

<@p1.showId /><#-- Why @showId == p2 ??? -->
{code}

First call <@p1.showId /> show the right result. But after call <@p2.showId />, 
if you call <@p1.showId /> again, the result is wrong.


> Import 2 different files which include 1 same file makes vars the same
> ----------------------------------------------------------------------
>
>                 Key: FREEMARKER-72
>                 URL: https://issues.apache.org/jira/browse/FREEMARKER-72
>             Project: Apache Freemarker
>          Issue Type: Bug
>          Components: engine
>    Affects Versions: 2.3.26-incubating
>            Reporter: Josh Wang
>
> Four Files:
> *p1.ftl*
> {code:java}
> <#assign id="p1"><#include "macro.ftl">
> {code}
> *p2.ftl*
> {code:java}
> <#assign id="p2"><#include "macro.ftl">
> {code}
> *macro.ftl*
> {code:java}
> <#macro showId>${id}</#macro>
> {code}
> *index.ftl*
> {code:java}
> <#import "p1.ftl" as p1><@p1.showId /><#-- @showId == p1 -->
> <#import "p2.ftl" as p2><@p2.showId /><#-- @showId == p2 -->
> <@p1.showId /><#-- Why @showId == p2 ??? -->
> {code}
> First call <@p1.showId /> show the right result. But after call <@p2.showId 
> />, if you call <@p1.showId /> again, the result is wrong.



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

Reply via email to