Topic on VisualEditor/Feedback

Suggestion: Reconsider using <nowiki> when wrapping bold or italics

10
197.218.91.29 (talkcontribs)

Issue:

There seem to be a considerable number of bad uses of markup when an apostrophe is used.

Steps to reproduce:

  1. Go to Sandbox
  2. Type a single apostrophe: '
  3. Select the apostrophe (highlight it)
  4. Set it as bold (Ctrl + B)
  5. Save page

Possible solutions

  1. Always use the html entities for those so it becomes '''&#39;''' ; or
  2. Wrap it around html tags, so instead of '''<nowiki/>'''' it becomes <b>'</b>

Notes:

I came upon these after seeing it in an article and searching for them. There are plenty of ridiculous examples:

https://en.wikipedia.org/w/index.php?title=Kilteel&diff=prev&oldid=616000454

The Archaeological Survey of Ireland notes a 16th or 17th century house in Blackchurch whose site has yet to be identified, presumably the <nowiki/><nowiki/>'<nowiki/>''stump of a castle''<nowiki/>'.<ref>KD015-011</ref> <nowiki/><nowiki/><nowiki/><nowiki/><nowiki/><nowiki/><nowiki/><nowiki/><nowiki/><nowiki/><nowiki/><nowiki/>

https://en.wikipedia.org/w/index.php?title=Belle_%28Beauty_and_the_Beast%29&diff=prev&oldid=837869142

<nowiki/><nowiki/><nowiki/><nowiki/>{{rquote|left|As Disney heroines go, Belle was an iconoclast. 

https://en.wikipedia.org/w/index.php?title=Andrzej_Grzegorczyk&diff=prev&oldid=830828900

<nowiki/>''<nowiki/>''<nowiki/>''<nowiki/>'''<nowiki/><nowiki/><nowiki/>'''''

https://it.wikipedia.org/w/index.php?title=HMS_Britannia_%281904%29&diff=prev&oldid=98332054

<nowiki/><nowiki/><nowiki/><nowiki/><nowiki/><nowiki/><nowiki/><nowiki/>''<nowiki/><nowiki/>''

See more: https://en.wikipedia.org/w/index.php?title=Special:Search&limit=500&offset=0&profile=default&search=insource%3A%2F%5C%3Cnowiki%5C%2F%5C%3E%5C%3Cnowiki%5C%2F%5C%3E%2F

197.218.91.29 (talkcontribs)

Alternatively, the parser should be smart enough to normalize these nowikis and simply remove all markup(apostrophes) that will result in no content being rendered at all.

Whatamidoing (WMF) (talkcontribs)

@SSastry (WMF), is any of this covered by your existing collection of nowiki bugs?

Arlolra (talkcontribs)

The current set of normalizations performed before nowikis are added for correctness can be found at Parsoid/Normalizations

Empty styling tags should now be stripped, https://www.mediawiki.org/wiki/Parsoid/Normalizations#Strip_empty_headings_and_style_tags

Edits that result in runs of consecutive nowikis is still open and filed as, https://phabricator.wikimedia.org/T108009

Cleaning up old messes (at the first example above was from 2014, long before Parsoid added these normalizations) is filed as, https://phabricator.wikimedia.org/T107675

The workboard for Parsoid's nowikis is at, https://phabricator.wikimedia.org/tag/parsoid-nowiki/ but there doesn't seem to be anything specific about lone apostrophes, though the egregious examples don't really seem to be about that and should be covered by the above.

197.235.60.107 (talkcontribs)

>Empty styling tags should now be stripped,https://www.mediawiki.org/wiki/Parsoid/Normalizations#Strip_empty_headings_and_style_tags

Not true, or not working properly in all cases. I was just fiddling around with visualeditor, and discovered another (https://www.mediawiki.org/w/index.php?title=Project:Sandbox&diff=prev&oldid=2975510).

The steps to reproduce are similar to the ones above:

  1. Go to Sandbox
  2. Type a single apostrophe: '
  3. Select the apostrophe (highlight it)
  4. Set it as bold (Ctrl + B)
  5. Press backspace (delete the apostrophe)
  6. Save page

For whatever reason Visualeditor seems to keep the bold style tags, probably waiting for the user to type more stuff. While Visualeditor could certainly fully erase the <b> tags it doesn't make sense for parsoid to show it at all. My guess is that's the greatest source of these nowiki tags because the user can't even see it at all.

While it may be annoying, in the end VisualEditor could aggressively ask the user if they want to remove strange constructs from the rendering. Sometimes a user may just forget they left something like that behind.

Arlolra (talkcontribs)

Hmm, I'm having a hard time reproducing that, given the steps you've provided. Can you tell me about your OS / browser?

Also, if you're familiar with your browser's console, when you're saving your edit (with the "Review your changes" pane open), if you could copy the result of invoking ve.init.target.docToSave.body.outerHTML that would help me determine what Parsoid is receiving to be serialized.

Thanks.

197.235.60.107 (talkcontribs)

OS, Browser: Windows 7 , Chrome 68

It is strange, it was harder to reproduce it now. It seems to be related to editing an older revision:

  1. Click https://www.mediawiki.org/w/index.php?title=Project:Sandbox&action=edit&oldid=2975510
  2. Remove the apostrophe
  3. Save page

Markup(ve.init.target.docToSave.body.outerHTML) :

<p id="mwBA">Test</p>

<p id="mwBQ"></p><b id="mwBg"><span typeof="mw:Nowiki" id="mwBw"></span></b>

<p id="mwCA"><b id="mwCQ"><span typeof="mw:Nowiki" id="mwCg"></span></b></p></body>
197.235.60.107 (talkcontribs)

If you want the full thing it is :

<body id="mwAA" lang="en" class="mw-content-ltr sitedir-ltr ltr mw-body-content parsoid-body mediawiki mw-parser-output" dir="ltr"><div class="borderc8 backgroundc1" style="padding:0.3em 0.5em 0.3em 0.5em; border-style:solid; border-width:medium" about="#mwt1" typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"Please leave this line alone and write below (this is the coloured heading)","href":"./Template:Please_leave_this_line_alone_and_write_below_(this_is_the_coloured_heading)"},"params":{},"i":0}}]}" id="mwAg">
<p><span style="color:#cf7606; font-size:140%;"><b>Edit this page</b></span>
<meta property="mw:PageProp/notoc">
This "sandbox" page is to allow you to carry out experiments. Please feel free to try your skills at formatting here. If you want to learn more about how to edit a wiki, please read <a rel="mw:WikiLink" href="./Help:Editing_pages" title="Help:Editing pages">this introduction</a> or the <a rel="mw:WikiLink/Interwiki" href="https://en.wikipedia.org/wiki/Wikipedia:Tutorial" title="en:Wikipedia:Tutorial">tutorial at Wikipedia</a>. This Sandbox is for the classic editing interface. There's also a <a rel="mw:WikiLink" href="./VisualEditor:Test" title="VisualEditor:Test">Sandbox</a> for the <a rel="mw:WikiLink" href="./VisualEditor" title="VisualEditor">VisualEditor</a>.
<meta property="mw:PageProp/noeditsection">
To edit, <b><a rel="mw:ExtLink" class="external text" href="//www.mediawiki.org/w/index.php?title=Project:Sandbox&action=edit">click here</a></b> or <i>"edit"</i> at the top of the page, make your changes in the dialog box, and click the <i>"Save page"</i> button when you are finished.  Please do not add material that is any way offensive, that is copyrighted, or that is at all libelous.</p>

<p><b>If you are looking for information about testing MediaWiki, see <a rel="mw:WikiLink" href="./QA" title="QA" class="mw-redirect">QA</a>.</b></p>
<hr>
<p><i>Content added here will not stay permanently; this page is cleared regularly. <span class="plainlinks"> <a rel="mw:ExtLink" class="external text" href="//www.mediawiki.org/w/index.php?title=Project:Sandbox&oldid=456598&action=edit&summary=reset">Click here to reset the sandbox.</a></span></i></p>
</div><span about="#mwt1"> 

</span><h1 about="#mwt1" id="Testing_Area">Testing Area</h1>

<p id="mwBA">Test</p>

<p id="mwBQ"></p><b id="mwBg"><span typeof="mw:Nowiki" id="mwBw"></span></b>

<p id="mwCA"><b id="mwCQ"><span typeof="mw:Nowiki" id="mwCg"></span></b></p></body>"
Arlolra (talkcontribs)

The contract Parsoid has with VE is that, in an edited context, VE will drop the nowiki spans, which still seem to be present here, so it makes sense why the serialized wikitext would still contain the nowikis.

That's from https://phabricator.wikimedia.org/T58381

Pre-edit,

<p><b><span typeof="mw:Nowiki"></span>'</b></p>

Post-edit,

<p></p><b><span typeof="mw:Nowiki"></span></b>

That looks like a VE bug, but maybe it's something Parsoid should be helping with, as discussed in, https://phabricator.wikimedia.org/T58381#1055479

197.235.60.107 (talkcontribs)

Funny thing. I tried deleting all content within the page, and that nowiki tag and its apostrophes friends don't want to be removed. According the the show changes button it remains in the article. Not sure if that's a bug or a feature to prevent removal of "unknown elements".

It is still unexpected.

Reply to "Suggestion: Reconsider using <nowiki> when wrapping bold or italics"