Page MenuHomePhabricator

Some characters in HTML5 fragments mess with wikitext
Closed, ResolvedPublic3 Estimated Story Points

Description

As reported in T175725: Deploy HTML5 sections to WMF production, some characters are problematic when used in wikitext anchor-encoded with html5 set as primary mode in $wgFragentMode.

  • <ref name="[]"> is broken because Cite uses wikitext for link generation. There's T29694 for it.
  • Some links like [{{fullurl:{{PAGENAME}}}}#{{anchorencode:[]}}] don't work anymore.

Event Timeline

kaldari set the point value for this task to 3.Nov 1 2017, 10:39 PM

T176176 might be related, since it also related to wikitext-significant characters showing up in html5 ids.

I have a silly question: why do we even use reference names in IDs? Because these IDs are also using reference numbers, they're not stable anyway.

Good question. I would certainly support removing the wikitext-generated part of the ID.

Please don't miss {{anchorencode}} part of the task. Quite a lot of templates in ruwiki using {{anchorencode}} / mw.uri.anchorEncode() to encode anchor links have broken in many cases due to use of []. en:Module:Footnotes, for one, will break in many cases if you try delpoy to enwiki.

Change 390356 had a related patch set uploaded (by MaxSem; owner: MaxSem):
[mediawiki/extensions/Cite@master] Don't break when reference names contain []

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

Change 390356 had a related patch set uploaded (by Legoktm; owner: MaxSem):
[mediawiki/extensions/Cite@master] Don't break when reference names contain []

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

Good question. I would certainly support removing the wikitext-generated part of the ID.

I merged this patch, but I'd like to see a follow-up task to remove the name part of the ID entirely.

Change 390356 merged by jenkins-bot:
[mediawiki/extensions/Cite@master] Don't break when reference names contain []

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

I have a silly question: why do we even use reference names in IDs? Because these IDs are also using reference numbers, they're not stable anyway.

I can come up with at least one application: if the reference name is generated somewhere deep in the code (for example, if it is a hash of the reference content retrieved from Wikidata), there is no other way to learn it to reuse in a different place in an article. Or is it? @cscott