Page MenuHomePhabricator

VisualEditor: Support editing citations defined within a template
Open, MediumPublic

Description

For example, look at https://en.wikipedia.org/w/index.php?title=Peach_Springs_Trading_Post&oldid=563257259&veaction=edit.

Citation [1] is defined inside the infobox template. It is then reused at the end of the first paragraph, but when you click the [1] there, you get an inspector with the message: "This reference is defined in a template or generated block and for now can be only edited in source mode."

This also comes up when citations are defined within a template like {{reflist}}, as at https://en.wikipedia.org/w/index.php?title=Helminthopsis&oldid=592365854.

See Also:
T53289

Details

Reference
bz50896

Related Objects

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:54 AM
bzimport set Reference to bz50896.

This should NOT be a low priority. It's quite common for an article to have ALL references inside a template - see, for example, https://en.wikipedia.org/wiki/Helminthopsis .

At the moment, VE is able to figure out that the citation information is elsewhere - a tooltip appears that says "This reference is defined in a template or other generated block, and for now can be only edited in source mode." If VE can figure that out, then it should be able to perform the following three additional steps:

  • Check if the information is in the {{reflist}} template (match the "ref name=" parameter in the body of the text to a ref name parameter within the reflist template)
  • If a match is found, pull the relevant citation information from the reflist template, allowing the user to edit it
  • After the edit is finished, put the (modified) citation information back into the reflist template

(Side note: for edit conflict purposes, this is an edit of the section where the reflist template is located, not where the footnote label exists within the body of the text).

If VE is NOT modified to allow users to edit such references/citations, users are going to be (randomly) frustrated because they can't edit any footnotes in some articles using VE (see above) and because in some articles (https://en.wikipedia.org/wiki/Pope_Francis , for example), there are occasional footnotes that aren't editable in VE.

(In reply to John Broughton from comment #1)

This should NOT be a low priority. It's quite common for an article to have
ALL references inside a template - see, for example,
https://en.wikipedia.org/wiki/Helminthopsis .

At the moment, VE is able to figure out that the citation information is
elsewhere - a tooltip appears that says "This reference is defined in a
template or other generated block, and for now can be only edited in source
mode." If VE can figure that out

We figure that out because we can tell that there's no actual reference on the page, so presumably it was made with a hack.

, then it should be able to perform the following three additional steps:

This doesn't actually follow.

  • Check if the information is in the {{reflist}} template (match the "ref

name=" parameter in the body of the text to a ref name parameter within the
reflist template)

No. That would require making up a list of hack templates that each wiki uses, which is a WONTFIX if ever there was one. See instead bug 51260 which will mean we can get rid of this class of template hacks once and for all.

  • If a match is found, pull the relevant citation information from the

reflist template, allowing the user to edit it

Again, this would require a list of hack extraction approaches for each of the hack templates. WONTFIX. Sorry, but these templates are ghastly abominations and should have been strangled at birth.

  • After the edit is finished, put the (modified) citation information back

into the reflist template

That requires magic psychic modification of wikitext. Yet again, WONTFIX. Sorry.

(Side note: for edit conflict purposes, this is an edit of the section where
the reflist template is located, not where the footnote label exists within
the body of the text).

You are mistaken about how edit conflict detection works. Sections don't come into it. See endless suggestions and bugs passim where this myth has been disproven.

If VE is NOT modified to allow users to edit such references/citations,
users are going to be (randomly) frustrated because they can't edit any
footnotes in some articles using VE (see above) and because in some articles
(https://en.wikipedia.org/wiki/Pope_Francis , for example), there are
occasional footnotes that aren't editable in VE.

Or, alternatively, we could dump the stupid templates that make it harder for users even using wikitext to know what on Earth is happening, and instead use the wikitext the way it was designed, without resorting to hacks of doom?

nshahquinn-wmf renamed this task from VisualEditor: Be able to edit references defined within a template to VisualEditor: Support editing citations defined within a template and reused outside it.Aug 4 2015, 7:32 PM
nshahquinn-wmf raised the priority of this task from Low to Medium.
nshahquinn-wmf updated the task description. (Show Details)
nshahquinn-wmf set Security to None.
nshahquinn-wmf renamed this task from VisualEditor: Support editing citations defined within a template and reused outside it to VisualEditor: Support editing citations defined within a template.Aug 4 2015, 7:34 PM
nshahquinn-wmf updated the task description. (Show Details)

Why isn't this given a higher priority, and/or assigned to someone? This issue affects every article that has an infobox with one or more citations, and that's a VERY large number, and continually increasing - and a high percentage of the most viewed articles DO have infoboxes.

More importantly, this isn't just an issue of problems with reuse: having a citation/footnote in a template such as an infobox also disrupts the numbering system for footnotes - the numbering that what appears in the body of an article, when in VE editing mode, doesn't match the list of footnotes shown in VE editing mode. That's obviously a source of confusion to those doing editing; again, this certainly affects thousands of articles, and quite probably tens of thousands.

We want as much information as possible in Wikipedia articles to have inline supporting sources, and infoboxes are extremely popular (and helpful to readers). But the combination - citations inside templates such as infoboxes - is currently disruptive when editing using VE. That should be fixed.

This limitation has been reported several times in the context of Content translation. In this case, the main limitation is that Content Translation cannot transfer those references from the source article into the translation, when adding a paragraph with references to translate. So more than being able to edit existing references (which would be great, but may be less common) here the issue is that these references are gone.

In addition, Content translation only supports the visual mode, users cannot switch to wikitext mode as a workaround there. The specific Content translation issue is captured in T209266: CX2: Support for references added by name when the details are inside a template for more details.

This ticket focuses on improving the support for references defined inside any template.
References defined inside the Reflist template seems one of the most prominent instances of the problem. So maybe it is worth focusing on fixing this particular case if that is simpler than finding a generic solution that works for all kinds of templates.

Based on reports from en editor about a problematic translation I found The Deer's Cry (Pärt) a good example article where most references cannot be edited with Visual Editor because the are defined inside the list of references:

Screenshot 2019-05-31 at 14.40.52.png (624×868 px, 261 KB)

To slightly restate the suggestion, a good starting goal would be for the content of a reference to be editable in cases where VE is able to identify the reference and open the Reference dialog. This essentially requires being able to figure out how to edit the element that now "only can be editing in source mode".

Based on this conversation with a Content translation user, Outreachy is another good example article for this kind of issue, where most references are defined inside a "reflist" template.

This is discussed in hewiki village pump: https://he.wikipedia.org/w/index.php?title=%D7%95%D7%99%D7%A7%D7%99%D7%A4%D7%93%D7%99%D7%94:%D7%9E%D7%96%D7%A0%D7%95%D7%9F&oldid=31292360#%D7%94%D7%A2%D7%95%D7%A8%D7%9A_%D7%94%D7%97%D7%96%D7%95%D7%AA%D7%99_%D7%9C%D7%90_%D7%A2%D7%95%D7%91%D7%93_%D7%A2%D7%9D_{{%D7%94%D7%A2%D7%A8%D7%94%7C...}}

To summarize the discussion there:

  • (background) hewiki is written in Hebrew, and Hebrew is right to left language. Using tags such as <ref> is not behaving nicely to the source editor as "ref" is all latin characters that force LTR, and there is no support translated tags ( T30980 )
  • Editors who use source editor commonly replace <ref> to template {{הערה}} which is basically {{#tag:ref}}. Editors who use VisualEditor complain this breaks reference editing, because VE lacks proper support for references defined in templates

Sharing a recent comment from a user on a ticket where this issue manifests in Content Translation since it uses the Visual Editor editing surface:

This bug is really the worst of the ones opened on ContentTranslation in my opinion, given the time spent by all the volunteer contributors who have to go back behind a translation to try and reformat the translations that have been substituted. It literally freezes the citation in a version that can't be edited later, except if somebody spend some time to fill a template. Not good to have such non-editable stuff in our wikis !

It still happens regularly in 2023, I have a script that at least removes unnecessary categories added when substituting citation templates. Check out "untranslated category" ("catégorie non traduite") in my bot's list of recent contributions, ie https://fr.wikipedia.org/w/index.php?title=Rowland_Prothero&diff=prev&oldid=210406768. I can just remove the category shown in red in the article, there is no automatic way to reverse the template substitution (except spend some days with regexes for low success..)

I also received complaints from editors at Russian Wikipedia that this behavior greatly interferes with their work.

@Pginer-WMF That seems like a different problem. The bug here is that editing references defined within a template doesn't work, and VisualEditor recognizes this and mostly prevents them from being messed up. The other bug is confusing, but it seems that ContentTranslation has some issues with templates used inside references, and it doesn't recognize this situation and messes up the markup as a result.