Come up with a better way to auto-label references
Open, LowPublic8 Story Points

Description

Add TemplateData configuration for how reference names should be generated.

Jdforrester-WMF updated the task description. (Show Details)
Jdforrester-WMF raised the priority of this task from to Normal.
Jdforrester-WMF added a subscriber: Jdforrester-WMF.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 11 2015, 7:29 PM
Jdforrester-WMF edited a custom field.

The ideal system would be to use TemplateData to specify which parameters should be used to generate the name from, but in cases where there is no such data we still need a sensible fallback, and the current system has the advantage of using latin numbers, which work with other languages well.

Mvolz added a subscriber: Mvolz.Mar 25 2015, 4:54 PM
Jdforrester-WMF lowered the priority of this task from Normal to Low.Apr 16 2015, 9:02 PM
Elitre added a subscriber: Elitre.Sep 2 2015, 3:31 PM

No progress on this? <ref name=":0"> is not just ugly, it looks like an error code or something.

No progress on this? <ref name=":0"> is not just ugly, it looks like an error code or something.

It's not in the top 100 things we're working on.

Anomie added a subscriber: Anomie.Nov 4 2015, 2:22 PM

Another reason to fix this bug: If people are copying wikitext between articles (which happens often enough that enwiki has a bot to look for it), sensibly-named references are easier to figure out what's going on if they copy text with a <ref name="..."/> (resulting in a broken reference in the copied-to article) and are less likely to have name collisions if they copy a reference that includes the full reference body text.

I ran into this earlier today. name=":0" is too generic and easily causes problems when bringing in content from another page (both in wikitext and through VE) because it is basically guaranteed to conflict if both pages had at least one VE-generated citation.

One small improvement we could make is use simple hash. Nothing strong or cryptographic, but something like string-hash.js (5 lines of code).

We can convert the digest number to a string with .toString(36) and produce a short unique string (taking care to check if it already exists, at which point one could add Math.random and hash again).

That takes care of the cross-article conflict problem and is better than starting the count at 0 and using :0 as id (which we currently do – also no idea why there is a colon in the name).

also no idea why there is a colon in the name

The Cite extension doesn't support integers as reference names. I don't know if colon specifically was chosen for any particular reason.

Neil_P._Quinn_WMF removed Neil_P._Quinn_WMF as the assignee of this task.Dec 11 2015, 10:31 PM

I'd love to see Citoid use some sort of reference naming! The idea with auto-generating name for each reference is a good alternative to manually setting them and I support it.

@Anomie, I believe that the colon was chosen because it's in the very small set of (things that can be used) and (characters present on the keyboards of most MediaWiki users). The first requirement explains why it's not all numbers (some non-numeric character is required), and the second explains why it's not a Latin alphabet character.

Krinkle removed a subscriber: Krinkle.May 20 2016, 6:08 PM

I ran into this earlier today. name=":0" is too generic and easily causes problems when bringing in content from another page (both in wikitext and through VE) because it is basically guaranteed to conflict if both pages had at least one VE-generated citation.

I agree. We don't (yet) need a system that creates meaningful names, but we need one that doesn't generate likely collisions.

If someone can point me to where the current code lives, I'll write up a patch and submit it.

If someone can point me to where the current code lives

I think this is modules/ve-cite/ve.dm.MWReferenceNode.js in the Cite extension, see the "Generate a name starting with ':' to distinguish it from normal names" comment

I think this is modules/ve-cite/ve.dm.MWReferenceNode.js in the Cite extension, see the "Generate a name starting with ':' to distinguish it from normal names" comment

Thanks for the pointer. I'm working on this. For folks who are also looking that isn't the only place where we expect that reference numbering: https://phabricator.wikimedia.org/diffusion/ECIT/browse/master/modules/ve-cite/ve.ui.MWReferenceSearchWidget.js;06376669d9c1895d9b312998d0ee331520eea6a1$161-165

Boghog added a subscriber: Boghog.Apr 2 2017, 7:12 PM

While ref tags that take the form of ":0", ":1", ":2" are unique, they are not very informative. One alternative would be a Harvard style ref tag in the form of first authors last name + year of publication (i.e., "Smith_2017").

@Boghog I agree + if there were more different publications by Smith from 2017, then Smith_2017a, Smith_2017b...

TheDJ added a subscriber: TheDJ.Apr 4 2017, 8:53 AM
tomasz removed a subscriber: tomasz.Jun 11 2017, 10:59 PM