Page MenuHomePhabricator

MediaWiki's info action headers need anchors
Closed, ResolvedPublic

Description

The headers of MediaWiki's info action should have anchors, similar to anchors created by wikitext headers (i.e., "== Foo =="). The current HTML output of https://www.mediawiki.org/wiki/MediaWiki?action=info looks like this (for a particular section header):


<h2>Edit history</h2>

Ideally it would look something like this:


<h2> <span class="mw-headline" id="Edit_history">Edit history</span></h2>

Looking at the InfoAction.php code (https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/core.git;a=blob;f=includes/actions/InfoAction.php), it seems it's already using addHeader. So perhaps there's a flag that can be passed to this function to add the span/CSS id? Or perhaps $wgParser needs to be called? I'm not sure.

It shouldn't be too difficult to add an anchor here, though. It'll need to be auto-generated to account for localization/customization of the interface messages, though. Marking this as easy.


Version: unspecified
Severity: normal
URL: https://www.mediawiki.org/wiki/MediaWiki?action=info

Details

Reference
bz39954

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 1:00 AM
bzimport set Reference to bz39954.
bzimport added a subscriber: Unknown Object (MLST).
MZMcBride created this task.Sep 4 2012, 1:46 AM

(In reply to comment #0)

Looking at the InfoAction.php code
(https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/core.git;a=blob;f=includes/actions/InfoAction.php),
it seems it's already using addHeader. So perhaps there's a flag that can be
passed to this function to add the span/CSS id? Or perhaps $wgParser needs to
be called? I'm not sure.

Hmm. I hadn't realized that the addHeader function is local to InfoAction.php. I thought this was a global function.

So perhaps there's a global function that can be employed here instead? It looks like Special:Version has the behavior I want. It seems to use Xml::element('h2' ...) for this. Instead of addHeader() calling Html::element() as it does now, maybe it can simply call Xml::element()? Just a pointer for the person who ends up trying to resolve this bug.

Gerrit change 22547