Add TemplateData configuration for how reference names should be generated.
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.
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).
@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.
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.
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
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").