Page MenuHomePhabricator

Migrate citation IDs to HTML5 encoding
Closed, ResolvedPublic

Description

T152540 migrated section IDs, but citation ids (from the Cite extension) are still using the old .7B.7B style encoding.

This makes the address bar very hard to read for wikis which don't use the latin script for writing.

Event Timeline

cscott created this task.Sep 18 2017, 7:10 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 18 2017, 7:10 PM

Change 378774 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/extensions/Cite@master] Use HTML5 id attributes; remove use of deprecated Sanitizer::escapeId()

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

cscott claimed this task.Sep 18 2017, 7:31 PM
cscott added subscribers: MaxSem, Krinkle.

Current patch mostly fixes this but if you set $wgFragmentMode = ['html5']....

$ echo '<sup id="cite_ref-&#123;&#124;a&#125;&#125;_1-0" class="reference">[[#cite_note-&#123;&#123;echo&#124;a&#125;&#125;-1|&#91;1&#93;]]</sup>' | php maintenance/parse.php 

<div class="mw-parser-output"><p><sup id="cite_ref-&#123;&#123;echo&#124;a&#125;&#125;_1-0" class="reference"><a href="#cite_notea}1">&#91;1&#93;</a></sup>
</p></div>

Look at the href attribute: something in the core parser is double-expanding the attribute value, but it is usually protected (when wgFragmentMode = legacy) by the URL escaping.

So that needs to be fixed in the core parser (or else I need to come up with a better way of protecting the wikilink): {T176176: HTML5 ids seems to change how wikilink fragments are parsed (when LanguageConverter is enabled)}

cscott added a subscriber: Anomie.Sep 18 2017, 8:37 PM
Elitre added a subscriber: Elitre.Sep 21 2017, 12:38 PM

Change 378774 merged by jenkins-bot:
[mediawiki/extensions/Cite@master] Use HTML5 id attributes; remove use of deprecated Sanitizer::escapeId()

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

Krinkle removed a subscriber: Krinkle.Nov 1 2017, 7:44 PM
cscott closed this task as Resolved.Dec 1 2017, 8:49 PM

Is this Resolved?

Appears to be, yes. In current master:

$ echo '<sup id="cite_ref-&#123;&#124;a&#125;&#125;_1-0" class="reference">[[#cite_note-&#123;&#123;echo&#124;a&#125;&#125;-1|&#91;1&#93;]]</sup>' | php maintenance/parse.php
<div class="mw-parser-output"><p><sup id="cite_ref-&#123;&#124;a&#125;&#125;_1-0" class="reference"><a href="#cite_note-{{echo|a}}-1">&#91;1&#93;</a></sup>
</p></div>

The href attribute is now correct.