Last modified: 2014-01-15 22:19:08 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T26774, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 24774 - rvexpandtemplates=true does not expand templates in ref tags
rvexpandtemplates=true does not expand templates in ref tags
Status: REOPENED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.17.x
All All
: Normal normal (vote)
: ---
Assigned To: Roan Kattouw
:
Depends on: 2700
Blocks:
  Show dependency treegraph
 
Reported: 2010-08-13 05:54 UTC by Luke
Modified: 2014-01-15 22:19 UTC (History)
7 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Luke 2010-08-13 05:54:48 UTC
Any call to the API with action=query, prop=revisions, rvprop=content, and rvexpandtemplates=true does not have expanded templates in the content when that template is contained within <ref></ref> tags.

To reproduce, just make any such call to the API.  For example:

http://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles=Train&rvlimit=1&rvprop=content&redirects=true&rvexpandtemplates=true

Note that the templates within <ref> tags are not expanded:

<ref>{{cite web | title = Train (noun) | work = (definition - Compact OED) | publisher = Oxford University Press | url = http://www.askoxford.com/concise_oed/train?view=uk | accessdate = 2008-03-18}}</ref>

It should instead expand the template like this:

<ref><span class="citation web"
>[http://www.askoxford.com/concise_oed/train?view=uk "Train (noun)"]. ''<nowiki />(definition - Compact OED)<nowiki />''. Oxford University Press<span class="printonly">. http://www.askoxford.com/concise_oed/train?view=uk</span><span class="reference-accessdate">. Retrieved 2008-03-18</span>.</span><span
    class="Z3988"
    title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=bookitem&rft.btitle=Train+%28noun%29&rft.atitle=%28definition+-+Compact+OED%29&rft.pub=Oxford+University+Press&rft_id=http%3A%2F%2Fwww.askoxford.com%2Fconcise_oed%2Ftrain%3Fview%3Duk&rfr_id=info:sid/en.wikipedia.org:API"><span style="display: none;">&nbsp;</span></span></ref>

This has no good workaround; the best I can find is to grab all of the unexpanded templates and feed them into another call to the API with action=expandtemplates and text=(the templates), which is not very good not only because it's extra hassle, but also because it requires twice as many calls to the API, which inevitably slows things down considerably.

Build 2010-08-12 on Windows 7 Enterprise (though it being the result of an API call, I would imagine it reproduces anywhere)
Comment 1 Roan Kattouw 2010-08-13 09:33:08 UTC

*** This bug has been marked as a duplicate of bug 2257 ***
Comment 2 Bawolff (Brian Wolff) 2010-08-14 01:27:57 UTC
Perhaps I'm missing something, but I don't really see how this is a duplicate of bug 2257, since that bug is about letting the template parameters be expanded when rendering the tag extensions, where this bug is about the templates inside <tag> extensions aren't expanded by the rvexpandtemplates parameter of the api. Arguably i don't think they should be expanded, but i don't think the bugs are the same.
Comment 3 Luke 2010-08-15 04:07:50 UTC
I definitely would not call this a duplicate of bug 2257.  The problem in this bug is not that I *can't* expand the templates between <tag> extensions; the problem is that it requires two calls to the API for me to do so, which for large pages slows things down considerably.  The workaround described in bug 2257 doesn't help with this problem at all, since the wiki markup in your standard wiki page does not make use of the {{#tag:ref|...}} template.

I suppose the question does then present itself regarding whether or not one would expect those templates to be expanded, but intuitively if I tell the API to "expand templates", it seems to me that *all* templates should be expanded - that's what I'm looking for when I pass in that argument, after all.
Comment 4 Krinkle 2010-08-15 04:26:35 UTC
See also https://bugzilla.wikimedia.org/show_bug.cgi?id=2700
Comment 5 Roan Kattouw 2010-09-08 18:41:35 UTC
This is a duplicate of bug 2257 because both are caused by the same underlying issue, which is that template calls inside <ref> tags are not expanded in the template expansion (preprocessor) phase, which happens before the <ref> expansion (parser) phase. &rvexpandtemplates=true runs wikitext through the preprocessor but not through the parser.

*** This bug has been marked as a duplicate of bug 2257 ***
Comment 6 Jesús Martínez Novo (Ciencia Al Poder) 2014-01-15 22:19:08 UTC
(In reply to comment #5)
> This is a duplicate of bug 2257 because (...)

This is definitively not a duplicate. While bug 2257 is RESOLVED FIXED, this bug remains.

See for example:

https://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles=Wikipedia&rvprop=content&rvexpandtemplates

All templates are expanded, except those inside <ref></ref> tags.

I think it may be dependent of bug 2700, so fixing 2700 may also fix this. But let's give this bug open since it's a consequence of 2700, not *the same* bug

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links