Provide a way how to find out if there are no references or the number of references in given group
Open, NormalPublic


Currently there is no way how to find out if the <references [group="..."] /> tag is empty or not.

Since T123236: <references /> without any <ref> on page does not trigger/display an error may collide with T32763: Cite: If there's no <references /> block on the page, insert the wikitext for one automatically in the right place and/or T56906: Append a references list to bottom of the page when the first reference is added, I'm creating this as an alternative/superior task to that one.

The deal is that it is necessary to find out in wikitext if the desired group of references contains any reference or not.

The usecase:

Standardized footer of page contains the section == Local references == (yet more formatted (wrapped in <div> etc.)), but only if there is at least one <ref group="local"> in the page. If there is none, such section is not present.

Currently there is no way, how to incorporate this into the template which would be like:

Template:Page footer (pseudowikitext, since there is no appropriate code for that)

This is a part of ''{{{series}}}'' series.

== References ==
<references />

*if not empty( <references group="local" /> ) then*
<div class="localReferences">
== Local references ==
These are local references. They serve only for blah blah blah....
<references group="local" />
*end if*

[[Category:{{{publishing date}}}]]

I tried {{#if:{{#tag:references}}|<references />|nothing}} but it didn't work, since the <references /> can be triggerred only once ATM.

So perhaps the new {{#refsingroup:foo}} (and {{#refsingroup:}} for the generic, ungroupped refs) should be added. This would return the number of references in such group, therefore it would be even possible not to only decide whether add some code or not, but even format it according to the number, such as:

== References ==
<div style="column-count: {{#ifexpr:{{#refsingroup:}} > 10 | 2 | 1 }};">
<references />

(aka make two cols references block if there is more than 10 references...)

Danny_B created this task.Jan 18 2016, 2:31 AM
Danny_B updated the task description. (Show Details)
Danny_B raised the priority of this task from to Normal.
Danny_B added a project: Cite.
Danny_B added a subscriber: Danny_B.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 18 2016, 2:31 AM