- Mentioned In
- T209493: VE is transforming citation templates into formatted text with "cite class" tags (when copying a reference defined within template-generated reflist)
T232461: Read-mode references pasted into VE via a third-party editor are not stripped
- Mentioned Here
- T236220: As a contributor I want to know why references pasted from read mode do not appear in VE
I wrote a bot to fix this error when it shows in the wikitext. Non-trivial because of determining underlying citation by its number. The most recent regress injected about 3000 bad citations on enwiki, which the bot has fixed. There are probably more in other wikis, and in non-mainspace. If the bot is needed again available at https://en.wikipedia.org/wiki/User:GreenC_bot/Job_18
This may still be active under certain conditions:
It was added in this diff
I contacted the editor how the edit was made:
It appears the content was copy-pasted either:
(2) from another paragraph of the same article using the visual editor, or (3) from another paragraph of the same article using the visual editor, but opened in a new tab (i.e., with two tabs of the same article opened on my browser)
The garbled text did not preexist anywhere but newly generated.
@Esanders, how'd you arrive at not providing contributors any feedback about their attempted paste?
Reason for my question: I found it confusing that, despite nothing being shown on VE's edit surface, my attempted paste seemed to have some effect considering it activates the "Publish changes" button (watch this video, beginning at 0:09).
I'd have assumed that rather than pasting nothing, we'd paste the reference in plaintext to communicate to contributors something like: copy and paste is not broken; however, copying and pasting this type of content (in this case, a reference from read mode) is not supported
Technically, pasting from Wikipedia read mode is no different than pasting from an external website, and there are many sanitisations that happen during paste of external HTML, including
- Removing of certain tags that aren't editable in VE, and probably not intended to be preserved: <u>, <time>, <lang>, <span>, <font>, <fieldset> ...
- Removing of addition tag attributes, that also aren't editable and may be adding unwanted styling (font size/colour)
- Removing of external links
- Removing of Wiki read mode citations
If the user pastes a large block of text, they may trigger multiple of these sanitisation rules, so rather than try to display a large warning displaying of these, it is just understood that you can't paste anything into VE.
Note that other rich content will not paste "correctly" into VE, such as templates, images, and extensions (code blocks, math equations).
Other than detecting things like citations, it would not be generically possible to know if the pasted content had come from Wikipedia or any other site, it is just regular HTML.
When we switch to Parsoid HTML for read mode, it should be possible to preserve all rich content, including references.