Page MenuHomePhabricator

VE is transforming citation templates into formatted text with "cite class" tags (when copying a reference defined within template-generated reflist)
Closed, ResolvedPublic

Description

... and we don't know why. See edit one and a second edit here.

See also this permalink to research TTM has done.

Event Timeline

Apparently the bug is not yet dead. This one popped up this morning

A common component of these failures appears to be that the references are named.

This edit at We Are the Romans was apparently made by copy/paste from one article to another using ve. related to the original issue? I don't know but clearly a failure of ve that needs fixing. Discussion about that edit is at the editor's talk page.

ssastry added subscribers: JTannerWMF, ssastry.

@JTannerWMF For now, I moved this to the non-parsoid tasks column on the phab board. This substing looks like a VE issue as far as I can tell. Parsoid won't subst a template unless the template annotations are missing or get dropped. But, if your investigation points at Parsoid, we'll take a look.

May also happen with 2017 wikitext editor. This page creation page creation has text and citations that appear to have been copy/pasted from Venom (2018_film).

I thought this task might be related to T207303, but on closer look it doesn't look related. That problem affected existing references, while this one affects newly inserted ones.

Investigating copy/paste was a good idea. The problem is reproducible with this small page:
https://en.wikipedia.org/w/index.php?title=User:Matma_Rex/sandbox&oldid=878784265&veaction=edit

foo<ref name=a />

{{Reflist|refs=
<ref name=a>{{Cite book|title=Blah|last=Smith|first=John|publisher=|year=|isbn=|location=|pages=}}</ref>
}}

When you copy-paste this reference from VE to another VE (or to NWE), it gets "substed":

<ref name="a"><cite class="citation book">Smith, John. ''Blah''.</cite><templatestyles src="Module:Citation/CS1/styles.css"></templatestyles></ref>

To cause the problem, the reference must be defined within a references block using {{Reflist|…}}, rather than within text. (Also, the references block must be defined using a template, <references>…</references> does not cause the problem: https://en.wikipedia.org/w/index.php?title=User:Matma_Rex/sandbox&oldid=878784347.)


Additionally, the reference is not editable like a normal "cite book" template in VE, and trying to edit it in this broken state has no effect (changes are ignored when saving the page).

image.png (410×522 px, 26 KB)

Parsoid does not provide information about templates used within individual references here, because the entire reflist containing them is a template. I think we might have to make these references non-editable within VE (same as when a reference is defined e.g. within an infobox parameter, and reused in the article). Not sure how easy that would be to do.

matmarex renamed this task from VE is substing citation templates to VE is "substing" citation templates (when copying a reference defined within template-generated reflist).Jan 16 2019, 10:47 PM
matmarex added a project: Cite.

Another instance of this was reported by @Lfstevens: https://www.mediawiki.org/wiki/Topic:Uulh8h1z2mufkpp4

It addtionally has the ref names being changed (a '2' being appended for no apparent reason).

Beijing-Zhangjiakou Railway, The Tomb of Lu Xun, and Zeng Fengnian all exhibit similar issues to the issues described by this ticket – all have html versions of what should be cs1|2 templates (ctrl-f search the source for cite class. These articles were created with Content_translation and Content_translation/V2 – the first two were translated this month and the last one was translated in 2016.

That last diff (Roman Sondermajer) looks like a different "problem", namely that the editor manually created a basic citation. There's no template substing going on in any of these (see this edit to find out what happens when you subst a CS1 template), but the 4 October 2019 example doesn't look like a software problem at all.

Whatamidoing-WMF renamed this task from VE is "substing" citation templates (when copying a reference defined within template-generated reflist) to VE is transforming citation templates into formatted text with "cite class" tags (when copying a reference defined within template-generated reflist).Oct 22 2019, 6:03 PM

You're right, "substed" is not quite correct, but somehow, "templatestyles src="Module:Citation/CS1/styles.css" " is getting into the wikicode. I don't imagine that editors are typing that themselves manually, especially editors prone to using VE, so some interaction between the actions of the human editor and VE's programming are probably causing this bug.

Similar bugs appear to be related to copy/paste activity.

Change 561988 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/Cite@master] Don't process references defined inside template-generated reflists

https://gerrit.wikimedia.org/r/561988

This turns out to be a one-line patch, but it took a lot of debugging before I found that out, heh.

Change 561988 merged by jenkins-bot:
[mediawiki/extensions/Cite@master] Don't process references defined inside template-generated reflists

https://gerrit.wikimedia.org/r/561988

Though, it looks like that issue was caused by copy-pasting from another wiki?

Izno removed a project: Regression.

Ah okay, that's probably T218420: CX2: <span class="Z3988".... Maybe CT needs a similar fix.