[MediaWiki-l] Cite errors when a reference is 2 templates deep

Andru Vallance andru at tinymighty.com
Tue Mar 19 11:34:31 UTC 2013

Having delved into Cite_body.php, I've come accross this (Cite_body.php:569)

		# The following assumes that the parsed <ref>s sent within
		# the <references> block were the most recent calls to
		# <ref>.  This assumption is true for all known use cases,
		# but not strictly enforced by the parser.  It is possible
		# that some unusual combination of #tag, <references> and
		# conditional parser functions could be created that would
		# lead to malformed references here.

If I comment out line 582:

		$this->rollbackRef( $type, $ref_key, $ref_group, $ref_index );

Then my references reappear, albeit with no counts (and therefore the 
links from article to references and visa versa don't work)

So, it would appear that the parser is parsing the <ref> calls within 
the <references> block before it parses the <ref>'s in the templates 

Leaving that line uncommented, I've tried reformatting templates in 
various ways to attempt to stumble accross something which the parser 
can parse in the order indended, but I haven't found any combination of 
template changes which helps.

I'll continue to dig in Cite and try and come up with a bugfix, but as 
unfamiliar with the internals of Cite as I am, if anyone has any tips 
they would be greatly appreciated.


On 2013-03-19 09:50:27 +0000, Andru Vallance said:

> I'm a dev for PracticalPlants.org, a semantic wiki of plant use
> information. We've had long running mysterious problems with Cite which
> have been difficult to pin down, but since upgrading to MW 1.20.3 and
> Cite 1.20, the problem has become much worse.
> All our references on plant articles are at least 2 templates deep -
> the first template is a template used with semantic forms, the second
> is the Ref template we use.
> The result is that Cite outputs the following Cite error for every reference:
> Cite error: <ref> tag with name "PFAFimport-1" defined in <references>
> is not used in prior text.
> The ref tag name is most certainly used in the prior text in all cases.
> The <references> tag is placed after all <ref> (actually {{#tag:ref}})
> calls.
> If I place a <ref name="PFAFimport-1"/> or use our ref template {{Ref |
> PFAFimport-1}} directly in the wikitext after the semantic forms
> template then Cite lists it, so it seems like it's something to do with
> it being in a second level template.  Again, the ref tag with that name
> is certainly being output, and indeed it's rendered inline as a
> reference, it just fails to list it in the <references> section.
> Has anyone experienced anything similar? Anyone have any ideas?
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l at lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

More information about the MediaWiki-l mailing list