Citations templates
OpenPublic

Assigned To
None
Priority
Low
Author
bzimport
Subscribers
Dragons_flight, Gadget850, Mr.Z-man and 4 others
Projects
Reference
bz22134
Description

Author: wiki_ra

Description:
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.


Version: unspecified
Severity: enhancement
URL: https://en.wikipedia.org/wiki/User:Rannph%C3%A1irt%C3%AD_anaithnid/Cite.php

bzimport added a project: Cite.Via ConduitNov 21 2014, 10:46 PM
bzimport added a subscriber: wikibugs-l.
bzimport set Reference to bz22134.
bzimport created this task.Via LegacyJan 17 2010, 6:03 PM
Platonides added a comment.Via ConduitJan 17 2010, 6:22 PM

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.

bzimport added a comment.Via ConduitJan 17 2010, 6:35 PM

wiki_ra wrote:

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?

bzimport added a comment.Via ConduitJan 17 2010, 6:47 PM

wiki_ra wrote:

Thanks. Getting muddled between templates that to templates :"-)

Dragons_flight added a comment.Via ConduitJan 17 2010, 8:58 PM

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.

bzimport added a comment.Via ConduitJan 17 2010, 9:35 PM

wiki_ra wrote:

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.

Dragons_flight added a comment.Via ConduitJan 17 2010, 10:03 PM

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.

bzimport added a comment.Via ConduitJan 17 2010, 10:22 PM

wiki_ra wrote:

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).

Platonides added a comment.Via ConduitJan 17 2010, 11:22 PM

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}} ?

bzimport added a comment.Via ConduitJan 17 2010, 11:41 PM

wiki_ra wrote:

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

Mr.Z-man added a comment.Via ConduitJan 17 2010, 11:44 PM

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.

Platonides added a comment.Via ConduitJan 17 2010, 11:50 PM

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.

Dragons_flight added a comment.Via ConduitJan 18 2010, 12:05 AM

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.

MaxSem added a comment.Via ConduitApr 20 2012, 7:43 PM

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.

bzimport added a comment.Via ConduitFeb 21 2013, 11:37 PM

sumanah wrote:

Oliver, thanks for the bug report. Please check out https://www.mediawiki.org/wiki/Lua_scripting .

Gadget850 added a comment.Via ConduitSep 24 2014, 1:22 PM

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.

Add Comment

Column Prototype
This is a very early prototype of a persistent column. It is not expected to work yet, and leaving it open will activate other new features which will break things. Press "\" (backslash) on your keyboard to close it now.