Last modified: 2013-07-04 10:38:25 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T39838, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 37838 - VisualEditor: Improperly escapes <nowiki>
VisualEditor: Improperly escapes <nowiki>
Status: RESOLVED FIXED
Product: Parsoid
Classification: Unclassified
General (Other open bugs)
unspecified
All All
: Unprioritized normal
: ---
Assigned To: Gabriel Wicke
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-22 18:41 UTC by Liangent
Modified: 2013-07-04 10:38 UTC (History)
9 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Liangent 2012-06-22 18:41:10 UTC
If I input <nowiki>a</nowiki> in VE, save the page, then go back to the editor, text is broken in VE there.
Comment 1 James Forrester 2012-06-22 22:05:50 UTC
Mass-moving items into VisualEditor product
Comment 2 James Forrester 2012-06-23 00:54:23 UTC
Input HTML: <nowiki>a</nowiki>

Actual output wikitext after RT: <nowiki>&lt;nowiki&gt;</nowiki>a<nowiki>&lt;/nowiki&gt;</nowiki>

Expected wikitext: ???
Comment 3 Brion Vibber 2012-06-23 02:05:45 UTC
I would expect as wikitext: &lt;nowiki&gt;a&lt;/nowiki&gt;
Comment 4 Roan Kattouw 2012-08-06 22:07:50 UTC
Actually a Parsoid bug, moving.
Comment 5 ssastry 2012-08-06 22:14:11 UTC
Cannot replicate this either at http://parsoid.wmflabs.org/_html/ or on my CLI (excess newlines trimmed below) with the current HEAD.

------------------
[subbu@earth lib] echo "<nowiki>a</nowiki>" | node parse.js --html2wt 
<nowiki>a</nowiki>

[subbu@earth lib] echo "<nowiki>a</nowiki>" | node parse.js --html2wt | node parse.js
<p><span typeof="mw:Nowiki" data-parsoid="{&quot;tsr&quot;:[0,8],&quot;bsp&quot;:[0,18]}">a</span></p>

[subbu@earth lib] echo "<nowiki>a</nowiki>" | node parse.js --html2wt | node parse.js | node parse.js --html2wt
<nowiki>a</nowiki>

--------------------

Either VE is using an older Parsoid version -- or something else is broken.
Comment 6 ssastry 2012-08-06 22:18:19 UTC
Oh, never mind.  I got it wrong.  So, the input is not what I tested against.  The text to test is "&lt;nowiki&gt;a&lt;/nowiki&gt;
Comment 7 Gabriel Wicke 2012-08-06 23:07:04 UTC
<nowiki> is invalid HTML. The DOM representation of nowiki is <span typeof="mw:Nowiki">, which round-trips ok. Not sure if the VE handles this properly right now.

<nowiki> in a DOM text node (&lt;nowiki&gt; when entered in the HTML -> wikitext test form) properly serializes to &lt;nowiki&gt;.

Please test round-trip stuff on http://parsoid.wmflabs.org/ if possible ;)
Comment 8 Gabriel Wicke 2012-08-06 23:13:58 UTC
Hmm- seems as if I made a mistake while testing this. There might be a Parsoid bug after all.
Comment 9 Mark Holmquist 2012-08-06 23:29:06 UTC
So to be entirely clear:

$ echo "&lt;nowiki&gt;a&lt;/nowiki&gt;" | node parse.js --html2wt

actual
<nowiki>&lt;nowiki&gt;</nowiki>a<nowiki>&lt;/nowiki&gt;</nowiki>

expected
## &lt;nowiki&gt;a&lt;/nowiki&gt;

The problem is pretty clearly in mw.WikitextSerializer.js, near line 152, in the function wrapNonTextTokens. The serializer escapes any instances of <\/?nowiki> with its HTML-entitied counterpart, then wraps it in <nowiki>. I don't know why right now.

`git blame` seems to think Gabriel would know :)
Comment 10 Gabriel Wicke 2012-08-07 00:06:40 UTC
Fix submitted in https://gerrit.wikimedia.org/r/17921.
Comment 11 Gabriel Wicke 2012-08-08 17:39:44 UTC
Now merged.
Comment 12 Andre Klapper 2013-07-04 10:38:25 UTC
[Parsoid component reorg by merging CPP/* tickets into General. See bug 50685 for more information. Filter bugmail on this comment. parsoidreorg20130704]

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links