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

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

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)}

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

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.