I'm having some issues getting parts of a template to render where the html is embed inside if-else condition wiki code. I've been scratching my head over this issue thinking there was a problem with my template syntax or a limitation on how many nested templates there can be, but I have noticed that the issue fixes itself so long as the final page is treated as a template.
Please see the attached comparison screenshot for a better idea of the issue.
In my case, what I'm attempting to do is have a MediaWiki style Info Box. Each row of the infobox is run through an Info Box Row template to determine whether the row is a heading, data or data and a label. If the row is a heading it renders fine, but if the row is data with/without a label then it doesn't display except on the last line, unless the page that is embedding the template is also treated as a template where it renders perfectly.
The hierarchy of templates for this is four levels deep:
* Mini-YEAR (e.g. Mini 2017, since each year has different dates that need to be displayed)
* Mini (the parent template of the year-based versions)
* Info Box (the generic Info Box template used as a parent for Mini and any other info box)
* Info Box Row (the template used for each row of an Info Box)
The hierarchy is heavily inspired by MediaWiki, although the html has been adjusted to use dl,dt,dd rather than tables.
Because header rows render fine on both template and non-template pages, the Info Box Row template is being called. This is the template, where [ if="{{{data|}}}" ] doesn't seem to parse on non-template pages. Yet it does parse on template pages. For what it is worth I also took out the else wiki code tag between the header and data if wiki code but that didn't help. Here's the code where if parsing isn't working.
Code:
[if="{{{header|}}}"]
<dl>
<dd style="width:100%;text-align:center; font-weight: bold;">{{{header|}}}</dd>
</dl>
[else /]
[if="{{{data|}}}"]
<dl class="pairsJustified">
[if="{{{label|}}}"]
<dt style="text-align:left;">{{{label|}}}</dt>
<dd>{{{data|}}}</dd>
[else /]
<dd style="width: 100%; text-align: center;">{{{data|}}}</dd>
[/if]
</dl>
[/if]
[/if]
If it weren't for the fact that the above code does work on pages treated as a template I'd still be thinking the problem was my syntax.