frame:preprocess with ref tags loses the backlinks
Closed, ResolvedPublic

Description

All three of the outputs at

http://test2.wikipedia.org/wiki/Module_talk:BadRefExample

should be identical, but for some reason the construction that passes ref tags through frame:preprocess loses the backlink indicators.

For an extra dose of mystery, frame:preprocess with ref appear to work correctly within the confines of Special:ExpandTemplates, but not on ordinary pages.


Version: unspecified
Severity: normal
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=31834

bzimport set Reference to bz46815.
Dragons_flight created this task.Via LegacyApr 2 2013, 11:22 PM
Anomie added a comment.Via ConduitApr 4 2013, 2:58 PM

It's the same caching issue as what happens if you use enwiki's {{reflist}} with no parameters multiple times in a page (e.g. bug 31834). Note you can see the same thing with ordinary templates by creating a parameterless template containing a <ref> and use it multiple times on the page.

The Cite extension expects that it will get called for each <ref> tag, and returns a distinct strip marker each time. But frame:preprocess (and parameterless template transclusions, and frame:expandTemplate with identical args) doesn't bother to make a second call with the same wikitext; it just reuses the old output text (with the old strip marker) and so Cite never even knows that there was another <ref> tag. In addition, both of the "[1]" markers wind up with the same HTML id.

The solution to both this and bug 31834 is probably for PPFrame::expand() to be able to return some sort of "do not cache" indicator so callers would know when it was not safe to cache the returned string. And then Cite would arrange for PPFrame::expand() to indicate this when <ref> or <references> is found.

BTW, the reason that it "works" in Special:ExpandTemplates is because that half-parses the wikitext to get new wikitext, and then parses that new wikitext for the rendered view at the bottom. But this two-step parsing can sometimes have different results. Try it sometime with nested refs (e.g. {{#tag:ref|Ref A<ref>Ref B</ref>}}) to see another example of this.

gerritbot added a comment.Via ConduitDec 7 2013, 12:58 AM

Change 99792 had a related patch set uploaded by Anomie:
Add PPFrame::isVolatile and PPFrame::setVolatile

https://gerrit.wikimedia.org/r/99792

gerritbot added a comment.Via ConduitDec 7 2013, 12:59 AM

Change 99793 had a related patch set uploaded by Anomie:
Mark parser hook output as volatile

https://gerrit.wikimedia.org/r/99793

gerritbot added a comment.Via ConduitDec 7 2013, 12:59 AM

Change 99794 had a related patch set uploaded by Anomie:
Don't cache volatile wikitext

https://gerrit.wikimedia.org/r/99794

gerritbot added a comment.Via ConduitMay 30 2014, 6:21 PM

Change 99792 merged by jenkins-bot:
Add PPFrame::isVolatile and PPFrame::setVolatile

https://gerrit.wikimedia.org/r/99792

gerritbot added a comment.Via ConduitMay 30 2014, 9:09 PM

Change 99793 merged by jenkins-bot:
Mark parser hook output as volatile

https://gerrit.wikimedia.org/r/99793

gerritbot added a comment.Via ConduitJun 27 2014, 2:10 AM

Change 99794 merged by jenkins-bot:
Don't cache volatile wikitext

https://gerrit.wikimedia.org/r/99794

Add Comment