I would like to include a 'Notes' section in a transcluded template only if there are footnotes in the text entered in the template. How can I create a conditional statement that will include the <h2>Notes</h2>
header plus the <references group="lower-alpha" />
only if someone has actually created a footnote in this group?
I had this working in a template using two parameters, one called transcription
where I entered text and could footnote it using named {{efn}}
s. Then another parameter called footnotes
where I entered a list of the named {{efn}}
s along with the content of the note. Then I could use:
{{#if: {{{footnotes|}}}|
<h2>Notes</h2>
{{notelist|refs=
{{{footnotes|}}}
}}}}
But if I used too many <ref>
tags within the {{efn}}
s themselves, I would get errors.
I discovered today a line in the documentation that says, "Due to limitations in the MediaWiki software, do not use list defined footnotes that contain references."
So I need to switch to entering the content of the {{efn}}
or <ref group="lower-alpha">
, either way, directly into the text in the 'transcription' parameter.
I've made several different attempts to use {{#ifeq}}
to determine if there are any footnotes in the lower-alpha
group.
{{#ifeq: <references group="lower-alpha" />|||
<h2>Notes</h2>
<references group="lower-alpha" />}}
{{#ifeq: {{#tag:references group="lower-alpha"}}|||
<h2>Notes</h2>
<references group="lower-alpha" />}}
But this is not comparing the contents of <references group="lower-alpha" />
, it's literally comparing the statement <references group="lower-alpha" />
, which is not empty, so the result is always false.
Is there some way to determine if the contents of <references group="lower-alpha" />
is empty so I can use #ifeq
? Or is there maybe an even better way to do all of this?