← Back to team overview

zim-wiki team mailing list archive

Can't figure out template nesting

 

Hi,

I would like to nest templates where I can add some extra formatting for e.g. the top level heading. However, I am not sure how to do this nesting. I understand that using something like [% FOR ... -%] will create a new body that only looks or processes statements such as [%- IF ... -%] until [%- END -%] and [%- END %] closes the FOR loop. However, what to do with multiple nested statements?

This is what I got, for debug purposes:

[% FOR page IN pages -%]
<page>
[%- FOR heading IN page.headings(6) --%]
[%-- IF heading.level == '1' --%]<level/>[%-- END --%]
<heading>[% heading.content %]</heading>
[%-- END -%]
</page>
[%- END %]

But this gives me an warning like:

WARNING: No such parameter: heading

That tells me the inner IF loop is also executed outside the inner FOR loop. Can someone enlighten me about how to approach nested statements?

With regards,
- Jorgen