Page MenuHomePhabricator

Copy-paste of table from VE into another VE sometimes serialises with HTML elements and weird "href" attributes on cells
Closed, ResolvedPublic1 Estimated Story Points

Description

The syntax here look awkward

https://en.wikipedia.org/w/index.php?title=Solar_cycle&diff=next&oldid=675200924

| href="solar cell" | 1250

On the side: They seem to be some more weird old html attributes inside like <tr>

The href's match wikilinks, images, or alt text that are above the table on the page.

Event Timeline

Magioladitis raised the priority of this task from to Needs Triage.
Magioladitis updated the task description. (Show Details)
Magioladitis added a project: VisualEditor.
Magioladitis subscribed.

I indeed used copy/paste to add a table to Solar cycle.

Jdforrester-WMF renamed this task from VE introduces tables with weird href attributes to Copy-paste of odd content into VE introduces tables with weird href attributes.Aug 11 2015, 7:21 PM
Jdforrester-WMF set Security to None.
Jdforrester-WMF changed the task status from Open to Stalled.Aug 11 2015, 8:07 PM
Jdforrester-WMF subscribed.

Can you reproduce the problem? Copying the table from that article works fine for me.

@Lfstevens, @Magioladitis : Can you reproduce the problem?

Setting task status to "stalled". Please change to "open" after answering. Thanks!

I do not keep track of reported VE bugs to be honest. I found the bug
during a bug hunt.

Whatamidoing-WMF changed the task status from Stalled to Open.Feb 27 2016, 7:55 AM

Here's how you reproduce it:

  1. Open a page that has a bunch of links (and maybe some pictures, too).
  2. Paste this wikitext in, below a bunch of the links:
{| class="wikitable"
|+ First foods
|-
! Region !! Country !! First food !! Age at first food !! Feeding methods
|-
| Africa || Nigeria (Yoruba people) || ''eko'', a liquid pap from sorghum or maize || 6 months || The pap is held in the mother's cupped hand and poured into the baby's mouth.  The mother may force-feed the baby if the baby resists swallowing it.
|-
| Africa || Tanzania (Wagogo people) || ''uji'', a thin millet gruel || 3 to 4 months || Uji is drunk from a cup or gourd.
|-
| Africa || Mali || porridge or gruel made of millet or rice, perhaps with fish or potatoes || 7 months for girls and 10 months for boys || Children feed themselves, with their right hand, from a bowl.
|-
| Africa || Zimbabwe || ''bota'', a pap made from ground corn meal || 3 months or earlier || The mother or caregiver feeds the baby with a cup or spoon.
|-
| South America || Brazil || cornstarch and other grains || 4 months || Powdered milk was often given to newborns before 3 months of age.  After 6 months, most babies ate beans and rice or whatever the family ate.  Adult foods were broken into small bits and fed from the mother's hand.
|-
| South America || Guatemala || Cornmeal or Incaparina gruel, eggs, and fruit juice || 4 to 6 months || Mothers normally chose suitable food from among what the family was eating.  Cornmeal gruel was often given in a bottle.
|-
| South America || Peru || Wheat and potato soup || 6 to 8 months || Children were normally allowed to feed themselves, unless they were ill.  Urban children were given solid foods sooner than rural children.
|-
| South America || Dominican Republic || Orange juice, lime juice, beans || 3 months || Powdered milk was often given to newborns before 1 month of age.  Milk and juice were usually given in a bottle.  Fruits and vegetables were usually introduced before meat and beans, and grains were usually last.
|-
| Asia || Bhutan || porridge of rice flour or maize, cooked with butter || 2 months || Babies are fed from their mother's hands.
|-
| Asia || Bangladesh || || || The food is held in the caregiver's hands.
|-
| Asia || Nepal || grains || 6 months || Mothers pre-chewed grains that they were cooking for the rest of the family, mixed them with water or butter, and used their fingers to put the food in their baby's' mouth.  Babies in Hindu families were fed rice at the age of 3 weeks in the celebration of [[Annaprashana]], but did not regularly eat food until later.  Many mothers work on farms, and the introduction of solid foods often happened at the start of busy agricultural times.
|-
| Asia || Philippines || ''lugao'' (a rice porridge), mashed fruits or vegetables, or soft bread || 3 to 6 months || 
|-
| Oceania || Papua New Guinea || mashed papaya, sweet potato, pumpkin, and banana || 6 to 12 months || Water, vegetable broth and peeled sugar cane were given to young infants as an extra source of fluids.  Liquids were given in a bowl, cup, or bamboo straw.  Taro and meat were withheld until the baby was about a year old.  Traditionally, babies were not given solid foods until they could walk.
|-
| Oceania || Solomon Islands || Pre-chewed taro with water or sweet potato cooked in coconut milk || 0 to 9 months || Many pagan mothers began feeding their babies solid foods within 1 to 2 months after birth; they thoroughly chew the food and feed it mouth-to-mouth for the first few months.  This was also a common practice for feeding a hungry baby if the mother was temporarily unavailable.  [[Sukuru]] mothers usually began feeding solid foods between 6 and 9 months.  Some fed babies mouth-to-mouth; others pre-chewed, boiled, or mashed the food and gave it to the baby in a spoon or the baby's hand.
|-
| Oceania || Trobriand Islands || soup, then mashed or pre-chewed yams or taro  || 1 month || 
|-
| North America || USA || Infant cereal, then pureed fruits or vegetables || 2 to 6 months || Cereal was mixed with infant formula and given in a bottle, or fed to the baby with a spoon.  Poor women began feeding solid foods much earlier than wealthier women.
|}
  1. Save the page.
  2. See the mess: https://en.wikipedia.org/w/index.php?title=User:Whatamidoing_%28WMF%29/sandbox&diff=prev&oldid=707177876 and https://en.wikipedia.org/w/index.php?title=Baby_food&diff=prev&oldid=707177280 and https://en.wikipedia.org/w/index.php?title=User:Whatamidoing_(WMF)/sandbox&diff=707178243&oldid=707177876 All three of these are different, even though the two sandbox ones involve pasting exactly the same text (into different places on the page). Two of them have malformed tables (one severely).

I typed this wikitext table up in Apple Mail (as plain text), and pasted it into the article while in the visual editor (it converted it and everything looked correct until I saved). I can reproduce this problem in both Firefox 44 and Safari 9 on Mac OS 10.10.5 on 100% of attempts.

Whatamidoing-WMF renamed this task from Copy-paste of odd content into VE introduces tables with weird href attributes to Copy-paste of wikitext into VE introduces tables with weird href attributes.Feb 27 2016, 7:57 AM
Whatamidoing-WMF updated the task description. (Show Details)
Jdforrester-WMF renamed this task from Copy-paste of wikitext into VE introduces tables with weird href attributes to Copy-paste of wikitext table into VE sometimes serialises with HTML elements and weird "href" attributes on cells.Mar 3 2016, 5:44 PM
Jdforrester-WMF triaged this task as Medium priority.
Jdforrester-WMF added a project: Parsoid.
Jdforrester-WMF set the point value for this task to 1.

Example issue: Paste the above into https://en.wikipedia.org/wiki/Foobar?veaction=edit – the hrefs map to targets of various links in the document. Possibly the annotation indexes are being merged wrongly? Not sure why this would trigger Parsoid to serialise some of the elements as HTML rather than wikitext, though:

<table class="wikitable" role="note">
<caption role="note"> First foods</caption>
<tbody role="note">
! Region <th> Country </th>
! First food 
! Age at first food 
! Feeding methods
|-
| Africa 
| Nigeria (Yoruba people) 
| ''eko'', a liquid pap from sorghum or maize 
| href="metasyntactic variable" | 6 months 
…

New catch on fr.wp, with some HTML added to table when copy/pasting from an other article (diff).

=== Lithium naturel ===
<span data-ve-clipboard-key="0.7541924023058636-0"> Le lithium naturel est constitué des deux isotopes stables <sup href="magnésium">6</sup>Li et <sup>7</sup>Li, ce dernier étant majoritaire.</span><table class="wikitable"><tr>
! href="nucléide primordial" |Isotope
! href="nucléosynthèse primordiale" |Abondance<p>(pourcentage molaire)</p>
! href="étoile" |Gamme de variations</tr>
|- href="métabolisme"	
| href="Échangeur d'ions" |<sup href="magnésium">6</sup>Li
| href="fer" |{{unité|0.0759|(4)}}
| href="argile" |7,714 - 7,225<tr><td><sup>7</sup>Li</td>
|{{unité|0.9241(4)}}<td>92,275 - 92,786</td></tr></table>

Not sure why this would trigger Parsoid to serialise some of the elements as HTML rather than wikitext

Parsoid HTML can indicate that a node should be serialized using HTML-like syntax rather than normal wikitext syntax using attributes like data-parsoid='{"stx":"html"}'. If such an attribute is copied to, say, a table node, it will be serialized as <table>…</table> rather than {| … |}.

I can reliably reproduce the problem by copy-pasting the table "Solar activity events and approximate dates" from https://en.wikipedia.org/w/index.php?title=Solar_variation&oldid=673551856&veaction=edit to the very end of https://en.wikipedia.org/w/index.php?title=Solar_cycle&oldid=675200924&veaction=edit.

This looks like the same issue as T116460. Perhaps something about copy-pasting tables is special and that solution doesn't apply to them?

I followed a few false leads at first – I couldn't reproduce the problem on my local testing wiki, apparently because I have it configured to directly talk to Parsoid rather than RESTBase. Copy-pasting tables from view mode, or within a single page, also doesn't cause issues.

Here's how you reproduce it:

  1. Open a page that has a bunch of links (and maybe some pictures, too).
  2. Paste this wikitext in, below a bunch of the links: [snip]
  3. Save the page.

I think that was actually a different issue, and it was fixed as T146054. I couldn't reproduce any problems when pasting wikitext that gets converted into a a HTML table.

New catch on fr.wp, with some HTML added to table when copy/pasting from an other article (diff).

The data-ve-clipboard-key stuff is also probably unrelated and probably fixed already as T121588, although the rest of that diff looks like the same issue as this.

matmarex renamed this task from Copy-paste of wikitext table into VE sometimes serialises with HTML elements and weird "href" attributes on cells to Copy-paste of table from VE into another VE sometimes serialises with HTML elements and weird "href" attributes on cells.Aug 31 2018, 7:35 PM

Change 456743 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[VisualEditor/VisualEditor@master] ve.ce.Surface: Consistently sanitize external pastes

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

Nothing about the problem was actually specific to tables. I don't know why this is the only case where folks noticed the problem. This may also fix some other mysterious wikitext corruption issues…

Change 457467 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/VisualEditor@master] Add another test case for stripping RESTBase IDs

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

Change 456743 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] ve.ce.Surface: Consistently sanitize external pastes

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

Change 457898 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (a72861b26)

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

Change 457898 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (a72861b26)

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

Change 457467 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Add another test case for stripping RESTBase IDs

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