p2cli icon indicating copy to clipboard operation
p2cli copied to clipboard

Imported Macro Calls Fail to Execute Other Macros

Open Dragon-Git opened this issue 2 years ago • 1 comments

Problem Description

When calling other macros within an imported macro, it has been observed that the calls do not execute as intended.

Environment

  • Operating System: Windows 10
  • p2cli Version: r18

Reproduce

common.tpl

{% macro inner_test() export %}innertest{% endmacro %}

{% macro outter_test() export %}
outtertest begin
{{ inner_test() }}
outtertest end
{% endmacro %}

{{outter_test()}}

Macros calls are executed correctly

> p2 -t common.tpl

outtertest begin
innertest
outtertest end

Create another template and import the outter_test macro test.txt .

begin
{% import "common.tpl" outter_test %}{{outter_test()}}
end

Render test.txt, the contents of inner_test() are missing.

> p2 -t test.txt  
begin

outtertest begin

outtertest end

end

Dragon-Git avatar Oct 30 '23 13:10 Dragon-Git

This is a flaw in the underlying pongo2 library, which is what implements templating.

wrouesnel avatar Jan 09 '25 01:01 wrouesnel