Page MenuHomePhabricator

VisualEditor: Be able to name references manually in the reference dialog
Open, LowPublic


If you create a new reference, you can specify a name - great! If you try to modify an existing reference to add a name... oops.

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 2:01 AM
bzimport set Reference to bz50568.

Actually, it even looks like the ability to name a reference has been removed from the reference creation interface. Expanding the scope of this request accordingly.

Being able name references is an important step to allow compatibility with the classic wikitext editor: human-readable names are much easier to use than names like ":5".

Editor APerson at en.wp, is asking for this and suggests that the name of a reference could be set in the "Options" section along with the group name.

It would even be convenient if VisualEditor suggested a unique label for the ref, perhaps using the first alphabetic string of characters in the ref (usually the first author's last name).

Useful for default would be to read from the parameters of the cite template if provided. The following would be a useful preference order I think

  1. Lastname and Year (e.g. Smith2013)
  2. Author and year (e.g. Bob Smith2013)
  3. Lastname and serial number (e.g. Smith001)
  4. Title (first 3 words) and year (e.g. FreddieStarrAte1986)
  5. domain, underscore, page name (If only a bare url is given) (e.g. bbc_magazine-23969607)
  6. fist alphabetic string in reference (when neither a template or a url) and a string of four digits from the reference (e.g. Jones1999)
  7. fist alphabetic string in reference and a serial number (when neither a template or a url and no sequence of four digits is present) (e.g. Brown001)
  • Bug 57459 has been marked as a duplicate of this bug. ***

Perhaps Citoid could suggest a ref name.

The citoid extension could definitely come up with an automated reference name, but that should be filed as a separate issue as a feature request :). For editing citations, the extension uses the same reference dialog as the rest of VE.

Mvolz set Security to None.

Here's another idea for an automatically suggested (but still editable) ref name that would work with manually formatted citations:

Use the longest text string is in the citation, appending numbers as necessary to keep the names unique. You might end up with a lot of refs named "September", but it in many cases it will pick up the most significant keyword in the source's title.

At the triage meeting on 11 March it was agreed that this is too complex and imprecise to keep as a Q3 objective, but that a much more on-point task, T92432: Come up with a better way to auto-label references, could be done instead.

If you create a new reference, you can specify a name - great!

It's no longer possible to specify a name even when creating a new reference.

Izno updated the task description. (Show Details)

If we try to name a reference by only using a numeral, the system rejects it and says that numeral only reference names are not permitted.
I feel it is bogus that Visual Editor gets around this by adding a colon: e.g. - :17
That kind of reference name is wrong and unhelpful.
I hope that the ability to manually name references, or at least the ability to manually approve the generated name is restored.

When this is implemented it needs to take account of reused references:
i.e. if <ref name="Smith">...</ref> is renamed to <ref name="Jones">...</ref>
then all instances of <ref name="Smith" /> need to be automatically changed to <ref name="Jones" />

Thought will need to be given to the interaction of this and section editing.

When this is implemented it needs to take account of reused references:
i.e. if <ref name="Smith">...</ref> is renamed to <ref name="Jones">...</ref>
then all instances of <ref name="Smith" /> need to be automatically changed to <ref name="Jones" />

This is actually a very good point, and I think this actually makes changing the name impossible in some cases. (But it should be possible to allow setting the name for newly created references.)

Consider a page like this:

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

* [[George Washington]]
* [[John Adams]]<ref name="example" />

<references />

If you were to use VE to change the name of this reference, we would not be able to update the reuse inside the {{columns-list}} template, because the entire template is "opaque" – VE doesn't know about anything inside of it, it just displays the content.

My first thought is that this wont remain opaque to VE forever and so what is required is a workaround that exposes to VE some aspects about the contents of templates like {{columns-list}} even if cannot be edited yet.
For example, the template could expose metadata like:

References included:  'Smith' 'Jones' 'Patel'

where each of those is the name= parameter of a reference used inside it.

This would allow VE to display and error along the lines of "Cannot rename reference "Jones" - used in uneditable block. It would also prevent the naming of a new reference with a conflicting name.

It may also be useful for T52474 and similar tasks.

How significant this would be to program I haven't the foggiest though.

This has been proposed as part of the 2019 Community Wishlist: It's too early to know whether it will make the top 10 (voting will be open until the 30 November 2018), but it's currently among the more popular items, which suggests that solving this problem has widespread community support.

Change 743057 had a related patch set uploaded (by Chlod Alejandro; author: Chlod Alejandro):

[mediawiki/extensions/Cite@master] Add field for changing reference name

Is there any progress on this? I note (now, having not seen it before) the proposal for an alternative at which really doesn't look very helpful: if several of the refs in an article are to sources found on google books, or to a collection of articles written over time in one newspaper, or to journals from a particular online publisher, the editor will still have to struggle among a large set of semi-meaningless references (which of the umpteen ncbi refs in would be ncbi-12?) It surely cannot be that difficult for an algorithm, faced with a reference in a citation template, to do something like: "Is there a "last" or "last1" field? If so, use it as ref name, adding number if needed for disambiguation (or, better, adding year if present, then number if needed); if no "last1", then use first word (or 2 words, or 10 chars) of "title" field, similarly. If all else fails, use the domain name as proposed."