Last modified: 2014-09-24 13:22:52 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 T24134, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 22134 - Citations templates
Citations templates
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
Cite (Other open bugs)
unspecified
All All
: Low enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
https://en.wikipedia.org/wiki/User:Ra...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-01-17 18:03 UTC by Oliver Moran
Modified: 2014-09-24 13:22 UTC (History)
7 users (show)

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


Attachments

Description Oliver Moran 2010-01-17 18:03:14 UTC
During a discussion on citation styles at the Village Pump on the en.wiki, a number of editors expressed a dislike for citation templates. I greatly like them for a number of reasons (e.g. they help users unused to citing sources to do so properly, the lend to a consistent citation style, they make data that is naturally suitable to being machine readable comprehendible to a machine as discrete data, etc.).

The frequent source of the dislike mentioned by others was the time it takes a long time to transclude many such citation templates in a heavily cited page. I suggested enhancing Cite.php to do the citation templating.

The method I suggest is as follows:

---

Lorem ipsum dolor sit amet, consectetur adipiscing elit.<ref name="murphy" />

== References ==
<references>
<ref first="John" last="Murphy" title="Quisque Quis Orci Magna" publisher="Printing House Press" location="London" year="2009" page="55" isbn="978-3-16-148410-0" />
</references>
---

The above example renders the citation as follows:

J. Murphy. Quisque Quis Orci Magna. Printing House Press: London. 2009. Page 55. ISBN: 978-3-16-148410-0

I have a working example of the code necessary to implement this in a rudimentary manner at:

https://secure.wikimedia.org/wikipedia/en/wiki/User:Rannpháirt%C3%AD_anaithnid/Cite.php

It does not break current usage of Cite.php.

I'd be happy to continue development on this if it was picked up.
Comment 1 Platonides 2010-01-17 18:22:33 UTC
You are hardcoding parameters and output. It could call a template defined in $wgAllowCiteTemplates or a MediaWiki: message.
I'm also a bit wary of the verifying chunks of code you removed.

Your work seems to be more in line with the (abandoned) citation extension. 
Comment 2 Oliver Moran 2010-01-17 18:35:01 UTC
Re: hardcoding parameters and defining a template - indeed, its just a rough working example. I'm not suggesting *that* as code.

The "chunks of code" I removed seemed to have redundancy and limited the number of attributes to two (assumed) parameters. The new code (if I'm not mistaken) does precisely the same thing but without hardcoding a max numbers of attributes or assuming what those attributes must be if they are present. (I'd suggest taking that piece into trunk regardless of opinion about templates for citations as it would be more flexible going forward.)

I'm not aware of the citation template. What is/was it?
Comment 4 Oliver Moran 2010-01-17 18:47:33 UTC
Thanks. Getting muddled between templates that to templates :"-)
Comment 5 Robert Rohde 2010-01-17 20:58:49 UTC
As I mentioned to Oliver on wiki, anything that expects to code particular styles of referencing directly into Cite seems like a total non-starter.  The best that one could do is teach ref to call one or more templates automatically and that doesn't seem like much of a savings.

Since your main goal (Oliver's) is to improve standardization, the real targets should generally be the use and consistency of templates, not Cite itself.
Comment 6 Oliver Moran 2010-01-17 21:35:25 UTC
Referring to on-wiki templates is one way. Using actual ('real-life') standards e.g. APA, Harvard, etc. is another. Or a combination mix of both.

These could either be set by default (per installation) or specified (optionally probably), possibly in the <reference> tag e.g.:

<references style="harvard">
<ref ... />
</references>

(...or have this choice over-rided by user preferences, as was suggested by another user in that discussion e.g. user wants to see references displayed in APA style only.)

If it was to be taken in to Cite, I think the "real-life standards" would be the best place to start as it would give the greatest gains over templates and would be the most immediately usable by all MW installations.
Comment 7 Robert Rohde 2010-01-17 22:03:35 UTC
The templates represent the community's consensus about what they want citations to look like.  They are often originally based on standards but then deviated because at some point in the past the community decided those changes made them better.  There is no reason that the templates couldn't be used to implement letter-perfect versions of essentially any real-life citation standard if that is what the community wants.  However, first you'd have to convince the community that they want "real-life standards".  

The choice to adopt referencing standards, or not, is one for the community to make, and should generally not be enforced directly by Cite.
Comment 8 Oliver Moran 2010-01-17 22:22:38 UTC
From the points of view of Cite, I don't think it should be enforced. This suggestion may have come out of a discussion on WP but I making it purely in parallel to that. I'm saying it would be a nice feature if cite could handle basic citation meta data and spit it out in a standard format and style (not just on WP but on other installations too).

If WP goes for a standard style or not is a different matter (and from what I can see *enforcing* a standard style on WP looks like a non-starter).
Comment 9 Platonides 2010-01-17 23:22:39 UTC
You claim that:
> The frequent source of the dislike mentioned by others was the time it takes a
> long time to transclude many such citation templates in a heavily cited page. 
fixed by your proposal.

Why does it take "a long time"?

How is <ref first="John" last="Murphy" title="Quisque Quis Orci Magna"
publisher="Printing House Press" location="London" year="2009" page="55"
isbn="978-3-16-148410-0" /> better than {{ref|first=John|last=Murphy|title=Quisque Quis Orci Magna|publisher=Printing House Press|location=London|year=2009|page=55}} ?

Comment 10 Oliver Moran 2010-01-17 23:41:24 UTC
The users who said that (I believe) blamed the DB overhead costs of transcluding those templates many times. I don't believe the issue was one of bandwidth.

(There would also be additional benefits to doing it in Cite. For example, a user could override the installation- or the article-defined citation style with a preferred style defined in their user preferences.)

After hinting by Robert, I've opened an on-wiki suggestion of this idea here:

https://secure.wikimedia.org/wikipedia/en/wiki/Wikipedia:Village_pump_(proposals)#Cite_modifications
Comment 11 Alex Z. 2010-01-17 23:44:33 UTC
While I haven't actually verified this, my guess is that the cite templates are slow due to feature bloat and over-standardization. 

The cite templates on enwiki include all sorts of extra parameters for things like translations, summaries, multiple editors, etc. 90% of citations aren't going to use more than a few key parameters, but the templates still have to evaluate parser functions based on every possible option.

Additionally, almost every citation template is just a wrapper around [[Template:Citation/core]], adding a call to the meta-template for each usage and making the other problem worse by having even more extra parameters, many of which aren't even exposed in the standard templates.

The sample code is going to be faster because it doesn't have nearly as many options, so it can format the citation by just concatenating parameters and separators, and it does it all with PHP. That could still be extended to replicate the current citation templates, but then if a wiki wants a change to a reference format, it would have to be done by a sysadmin.
Comment 12 Platonides 2010-01-17 23:50:11 UTC
> The users who said that (I believe) blamed the DB overhead costs of
> transcluding those templates many times. I don't believe the issue was one of
> bandwidth.

The cost of fetching the template from db is the same. If a template is used 
several times, it is only grabbed the first one. NExt ones the content is reused.
You shouldn't be orried about that.
Comment 13 Robert Rohde 2010-01-18 00:05:29 UTC
Alex is correct, the lag is mostly the massive structure of Citation/core which has over 200 #if branches (though only a fraction would be called during any given execution).  None of it is individually bad, but taken collectively and called more than 100 times per article and it will really add up.

As an aside, I've been contemplating extending the parser caching of pages to allow for per-page template caching which would allow one to bypass re-rendering these rarely changed blocks most of the time.
Comment 14 Max Semenik 2012-04-20 19:43:35 UTC
rm patch-need-review, not an actual patch. Also, the code is just a proof-of-concept that is not ready to be committed. Newer efforts in this direction are TemplateAdventures and Lua.
Comment 15 Sumana Harihareswara 2013-02-21 23:37:04 UTC
Oliver, thanks for the bug report. Please check out https://www.mediawiki.org/wiki/Lua_scripting .
Comment 16 Gadget850 2014-09-24 13:22:52 UTC
Over the last two years the major citation templates on the English wiki have been converted to Lua which has mostly resolved the performance issues.

But, the use of these templates is not mandated nor universal. Other language wikis use different citation styles. On enwiki the templates are constantly maintained to reslove issues and add features. Moving the functionality into cite.php means that maintenance is going to be complicated and slowed.

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


Navigation
Links