Page MenuHomePhabricator

Links: External links with special characters, and surrounded by square brakets, are not rendered properly
Closed, ResolvedPublic

Description

Consider the wikitext [[https://test.com/query?q=%7Babc%7D test]], rendered correctly by MW parser as the text [test] linking to https://test.com/query?q={abc}.

Parsoid is unable to do a round-trip parsing of this, possibly confusing it with the syntax for internal links [[<page title> | <label>]]. The issue could either be solved by modifying the parsing from wikitext to html, or from html to wikitext:

Issue: wikitext -> html

The following conversion describes the problem when generating the HTML from a page with such a link:

Input

[[https://test.com/query?q=%7Babc%7D test]]

Current Output

<p data-parsoid='{"dsr":[0,44,0,0]}'>[[</p>s://test.com/query?q=%7Babc%7D test]]

Expected Output

[<a rel="mw:ExtLink" class="external text" href="https://test.com/query?q=%7Babc%7D" data-parsoid='{"targetOff":36,"contentOff</p>":[36,40],"dsr":[0,41,36,1]}'>test</a>]

Issue: html -> wikitext

The following conversion describes the problem when generating the wikitext for Visual Editor content that has such a link:

Input

[<a href="https://test.com/query?q=%7Babc%7D">test</a>]

Output

[[https://test.com/query?q=%7Babc%7D test]]

Expected Output (one possibility)

<nowiki>[</nowiki>[https://test.com/query?q=%7Babc%7D test]<nowiki>]</nowiki>

Which approach would you prefer?

Event Timeline

Restricted Application added subscribers: jeblad, Aklapper. · View Herald TranscriptJan 16 2019, 5:59 PM
Arlolra triaged this task as Normal priority.Jan 16 2019, 6:22 PM

Change 496206 had a related patch set uploaded (by Juan Osorio (Microsoft); owner: Juan Osorio (Microsoft)):
[mediawiki/services/parsoid@master] Fixes external links with special characters roundtrip

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

Change 496206 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Fixes external links with special characters roundtrip

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

Arlolra closed this task as Resolved.Mar 13 2019, 10:44 PM
Arlolra assigned this task to osorio-juan-microsoft.
Restricted Application added a project: User-Ryasmeen. · View Herald TranscriptMar 13 2019, 10:44 PM

Mentioned in SAL (#wikimedia-operations) [2019-03-14T17:32:56Z] <arlolra> Updated Parsoid to f3e2209 (T213950)