Page MenuHomePhabricator

[[#_foo|bar]] renders with href="#foo" , breaking Cite anchors with leading underscores
Closed, ResolvedPublic

Description

WIth $wgExperimentalHtmlIds, [[#_foo|bar]] renders as something like <a href="#foo">bar</a>, so apparently something's normalizing the leading underscore away. Because the Cite extension uses parsed messages with something like [[$1|$2]], wikis that have configured their Cite anchors to start with an underscore (like zhwiki) saw Cite break, because the href got normalized but <li id="_foo"> did not.

Details

Reference
bz27474

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:21 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz27474.
bzimport added a subscriber: Unknown Object (MLST).
  • Bug 27552 has been marked as a duplicate of this bug. ***

ayg wrote:

This is going to be because of r70526. I don't know how it could happen -- when I do <span id="_foo"> on my wiki, it translates to <span id="foo">. (Which might be a bad thing in itself, but wouldn't cause this bug.) My only guess offhand is that something isn't actually being sent through the parser here. I'll take a brief look.

ayg wrote:

Nope, this was caused by r68358. I give the details there. It only occurs if $wgHtml5 = false, which is probably why no one caught it in testing. (This is why we need to stop allowing $wgHtml5 = false, maybe for 1.18 -- we couldn't as long as Wikimedia used it.)

conrad.irwin wrote:

The only bug is that it's not being normalized away enough. "_" and " " are normally stripped from this place in titles.

If this wants to be changed so that we don't normalize; we'll have to verify that the links created by the ToC generator, the edit summary generator, {{#anchorencode}} and #blah all agree on the new behaviour.

See also bug 18431.

ayg wrote:

See discussion on r68358.

btw, relevant system message for cite that seems to cause this is [[mediawiki:Cite_reference_link_prefix]]. Deleting that page will reset it to the default, which would probably work around the issue. (Just mentioning it for any other wikis who have customized it. Someone from eowiki recently came on irc reporting the same issue)

Sorry, that should have been [[mediawiki:Cite_references_link_prefix]] ( Cite_references_link_prefix controls the link from the [1] to where the reference text is, Cite_reference_link_prefix controls the link going the other way )

ayg wrote:

I have to say I've got absolutely no idea why that message even exists. Can we just remove it from the software?

arno.raymond.lagrange wrote:

We removed [[:eo:mediawiki:Cite_references_link_prefix]] and now the bug looks like fixed.

Sounds like this isn't really a tarball blocker, then. Can we consider it closed or does this need to be documented in the Cite extension, or, as Aryeh suggests, just remove it?

I'm in favour of removing those messages, but it would be nice to know not only why they were created, but why so many sites decided to customize them. If they are as useless as they appear, I would not expect them to be customized.

Bawolff, they were using the pre-r32160 default.

Reverted r68358 in r85481.