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

Claude Brisson resolved VELOCITY-1004.
--------------------------------------
    Resolution: Fixed

Fixed by commit f48c8561.

> Inconsistent inline macro lookup under velocimacro.inline.local_scope
> ---------------------------------------------------------------------
>
>                 Key: VELOCITY-1004
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-1004
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 2.4.1
>            Reporter: Claude Brisson
>            Assignee: Claude Brisson
>            Priority: Minor
>             Fix For: 2.5
>
>
> With {{velocimacro.inline.local_scope = true}}, which inline macro a call 
> reaches depends on where the macro is defined in ways that are neither 
> consistent nor documented:
> * a macro defined in a parsed template is visible to what is rendered after 
> it, but a macro defined in the merged (root) template is not visible to the 
> templates it parses;
> * with {{velocimacro.inline.replace_global = true}}, the root template's 
> macro wins even inside a parsed template that defines its own macro of the 
> same name;
> * with {{velocimacro.inline.replace_global = true}}, only the root template 
> can override a library macro called by another library macro; a parsed 
> template cannot;
> * with {{velocimacro.library.autoreload = true}}, a call can resolve to the 
> root template's macro instead of the library's.
> Example, with {{local_scope = true}} and {{replace_global = true}}:
> {code}
> ## p.vm
> #macro(m)P#end#m()|#parse('c.vm')|#m()
> ## c.vm
> #macro(m)C#end#m()
> {code}
> renders {{P|P|P}}; expected {{P|C|P}}.
> Proposed lookup order for a macro call written in template T:
> # T's own macros;
> # if {{replace_global}} is true, the macros of the other templates of the 
> merge, the latest entered first;
> # the global macros (libraries);
> # the macros of the other templates of the merge, the latest entered first.
> The templates of a merge are its root template and the templates parsed so 
> far.
> Nothing changes when {{velocimacro.inline.local_scope}} is false (the 
> default).
> The documentation of both properties (configuration reference and user guide) 
> is to be corrected accordingly: the user guide's "fancy VM trick" needs both 
> properties, not {{local_scope}} alone.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to