https://bugzilla.wikimedia.org/show_bug.cgi?id=65603

            Bug ID: 65603
           Summary: Serializing images without data-parsoid normalizes
                    image names incorrectly
           Product: Parsoid
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: serializer
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
       Web browser: ---
   Mobile Platform: ---

If you parse wikitext like [[File:Ulmer M?nster-1024409.jpeg|frame]] , Parsoid
will produce a <figure> structure with
href="./File:Ulmer_M%3Fnster-1024409.jpeg" (which is correct, the question mark
is urlencoded) and resource="./File:Ulmer_M%3Fnster-1024409.jpeg" (not sure
whether this is correct).

When VisualEditor takes this information to build an inline image equivalent
(taking the href and the resource, and dropping everything else including
data-parsoid) we get [[File:Ulmer_M%3Fnster-1024409.jpeg|link=]] back. Note the
space changed to an underscore and ? changed to %3F. There was information in
data-parsoid to keep this from happening, but in this transformation VE
discards it.



$ echo '[[File:Ulmer M?nster-1024409.jpeg|frame]]' | node tests/parse.js
--apiURL=http://localhost/w/api.php
<!DOCTYPE html>
<html prefix="dc: http://purl.org/dc/terms/ mw:
http://mediawiki.org/rdf/";><head prefix="mwr:
http://localhost/wiki/Special:Redirect/";><meta property="mw:parsoidVersion"
content="0"/><link rel="dc:isVersionOf"
href="//localhost/wiki/Main_Page"/><title></title><base
href="//localhost/wiki/Main_Page"/></head><body
data-parsoid='{"dsr":[0,42,0,0]}'><figure class="mw-default-size"
typeof="mw:Image/Frame"
data-parsoid='{"optList":[{"ck":"framed","ak":"frame"}],"dsr":[0,41,2,2]}'><a
href="./File:Ulmer_M%3Fnster-1024409.jpeg"
data-parsoid='{"a":{"href":"./File:Ulmer_M%3Fnster-1024409.jpeg"},"sa":{},"dsr":[2,39,null,null]}'><img
resource="./File:Ulmer_M%3Fnster-1024409.jpeg"
src="//localhost/w/images/f/f1/Ulmer_M%3Fnster-1024409.jpeg" height="1024"
width="764"
data-parsoid='{"a":{"resource":"./File:Ulmer_M%3Fnster-1024409.jpeg","height":"1024","width":"764"},"sa":{"resource":"File:Ulmer
M?nster-1024409.jpeg"}}'/></a></figure>
</body></html>

$ echo '<p><span typeof="mw:Image" class="mw-default-size"><span><img
src="//localhost/w/images/f/f1/Ulmer_M%3Fnster-1024409.jpeg"
resource="./File:Ulmer_M%3Fnster-1024409.jpeg" width="764"
height="1024"></span></span></p>' | node tests/parse.js --html2wt
[[File:Ulmer_M%3Fnster-1024409.jpeg|link=]]

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to