Page MenuHomePhabricator

Image appears as wikitext in Parsoid output (but not legacy parser), and therefore as wikitext in VE
Open, Needs TriagePublicBUG REPORT

Description

Hello,

After carefully reviewing this case as well as discussing with another member working in the technical section of vi.wiki, we have determined that this is probably a visual editor error. The steps that cause the error to appear are presented as follows:

  • Access this link of the article on Vietnamese Wikipedia (https://w.wiki/BABo) and use the visual editor to edit.
  • After accessing the visual editor, you have seen that the image (of the section I pointed to above) is not displayed but instead displayed as the wiki code of the source code editor.

That is all the operations and display results of the error.

Thank you and looking forward to receiving feedback or guidance.

Event Timeline

This problem seems to have existed for a while and I encountered it again today so I reported it here. Maybe it should be checked and fixed soon. At least it is the images, which are very important for the illustration of Wikimedia projects.

Esanders renamed this task from A visual editor bug to Image appears as wikitext in Parsoid output (but not legacy parser), and therefore as wikitext in VE.Sep 11 2024, 1:26 PM

The problem appears to the be the nowikis in the caption, which are triggered by square brackets next to a link.

Here is a minimal failing roundtrip:

<figure class="mw-default-size" typeof="mw:File/Thumb"><a href="./File:Example.jpg" class="mw-file-description"><img resource="./File:Example.jpg" src="//upload.wikimedia.org/wikipedia/mediawiki/thumb/a/a9/Example.jpg/220px-Example.jpg" decoding="async" data-file-width="400" data-file-height="267" data-file-type="bitmap" height="147" width="220" srcset="//upload.wikimedia.org/wikipedia/mediawiki/thumb/a/a9/Example.jpg/330px-Example.jpg 1.5x, //upload.wikimedia.org/wikipedia/mediawiki/a/a9/Example.jpg 2x" class="mw-file-element"></a>
    <figcaption>[<a rel="mw:WikiLink" href="./Captionlink?action=edit&amp;redlink=1" title="Captionlink" class="new" typeof="mw:LocalizedAttrs" data-mw-i18n="{&quot;title&quot;:{&quot;lang&quot;:&quot;x-page&quot;,&quot;key&quot;:&quot;red-link-title&quot;,&quot;params&quot;:[&quot;Captionlink&quot;]}}">captionlink</a>]</figcaption>
</figure>

->

[[File:Example.jpg|thumb|[<nowiki/>[[captionlink]]<nowiki>]</nowiki>]]

->

<p>[[File:Example.jpg|thumb|[<span typeof="mw:Nowiki"></span><a rel="mw:WikiLink" href="./Captionlink?action=edit&amp;redlink=1" title="Captionlink" class="new" typeof="mw:LocalizedAttrs" data-mw-i18n="{&quot;title&quot;:{&quot;lang&quot;:&quot;x-page&quot;,&quot;key&quot;:&quot;red-link-title&quot;,&quot;params&quot;:[&quot;Captionlink&quot;]}}">captionlink</a>
    <span
        typeof="mw:Nowiki">]</span>]]</p>
ssastry subscribed.

Yes, indeed, I posted on the wrong phab task (which I had open to see if it was a duple): Here is a CLI session

The [<nowki/> trips up the tokenizer - both are necessary to trigger this.

─subbu@earth ~/work/wmf/parsoid  ‹master*› 
╰─➤  echo '[[File:Foo.jpg|thumb|foo [<nowiki/>[[Bar]] ]]' | php bin/parse.php
<p data-parsoid='{"dsr":[0,45,0,0]}'>[[File:Foo.jpg|thumb|foo [<span typeof="mw:Nowiki" data-parsoid='{"dsr":[26,35,9,0]}'></span><a rel="mw:WikiLink" href="./Bar" title="Bar" class="mw-disambig" data-parsoid='{"stx":"simple","a":{"href":"./Bar"},"sa":{"href":"Bar"},"dsr":[35,42,2,2]}'>Bar</a> ]]</p>

╭─subbu@earth ~/work/wmf/parsoid  ‹master*› 
╰─➤  echo '[[File:Foo.jpg|thumb|foo <nowiki/>[[Bar]] ]]' | php bin/parse.php                                                                                                                                 130 ↵
<figure class="mw-default-size" typeof="mw:File/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"foo &lt;nowiki/>[[Bar]] "}],"dsr":[0,44,2,2]}'><a href="./File:Foo.jpg" class="mw-file-description" data-parsoid='{"dsr":[2,21,null,null]}'><img resource="./File:Foo.jpg" src="//upload.wikimedia.org/wikipedia/commons/thumb/0/06/Foo.jpg/220px-Foo.jpg" decoding="async" data-file-width="300" data-file-height="197" data-file-type="bitmap" height="144" width="220" srcset="//upload.wikimedia.org/wikipedia/commons/0/06/Foo.jpg 1.5x, //upload.wikimedia.org/wikipedia/commons/0/06/Foo.jpg 2x" class="mw-file-element" data-parsoid='{"a":{"resource":"./File:Foo.jpg","height":"144","width":"220"},"sa":{"resource":"File:Foo.jpg"}}'/></a><figcaption data-parsoid='{"dsr":[21,42,0,0]}'>foo <span typeof="mw:Nowiki" data-parsoid='{"dsr":[25,34,9,0]}'></span><a rel="mw:WikiLink" href="./Bar" title="Bar" class="mw-disambig" data-parsoid='{"stx":"simple","a":{"href":"./Bar"},"sa":{"href":"Bar"},"dsr":[34,41,2,2]}'>Bar</a> </figcaption></figure>

╭─subbu@earth ~/work/wmf/parsoid  ‹master*› 
╰─➤  echo '[[File:Foo.jpg|thumb|foo [ [[Bar]] ]]' | php bin/parse.php
<figure class="mw-default-size" typeof="mw:File/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"foo [ [[Bar]] "}],"dsr":[0,37,2,2]}'><a href="./File:Foo.jpg" class="mw-file-description" data-parsoid='{"dsr":[2,21,null,null]}'><img resource="./File:Foo.jpg" src="//upload.wikimedia.org/wikipedia/commons/thumb/0/06/Foo.jpg/220px-Foo.jpg" decoding="async" data-file-width="300" data-file-height="197" data-file-type="bitmap" height="144" width="220" srcset="//upload.wikimedia.org/wikipedia/commons/0/06/Foo.jpg 1.5x, //upload.wikimedia.org/wikipedia/commons/0/06/Foo.jpg 2x" class="mw-file-element" data-parsoid='{"a":{"resource":"./File:Foo.jpg","height":"144","width":"220"},"sa":{"resource":"File:Foo.jpg"}}'/></a><figcaption data-parsoid='{"dsr":[21,35,0,0]}'>foo [ <a rel="mw:WikiLink" href="./Bar" title="Bar" class="mw-disambig" data-parsoid='{"stx":"simple","a":{"href":"./Bar"},"sa":{"href":"Bar"},"dsr":[27,34,2,2]}'>Bar</a> </figcaption></figure>