Gerrit Patch Uploader has uploaded a new change for review.
https://gerrit.wikimedia.org/r/286398
Change subject: API: Avoid duplicate IDs in API documentation
......................................................................
API: Avoid duplicate IDs in API documentation
With $wgExperimentalHtmlIds = true Sanitizer::escapeId( 'main/credits' )
is equal to 'main/credits'. This generate a duplicate ID.
This change generates the additional <span> only with
$wgExperimentalHtmlIds = false.
Bug: T134155
Change-Id: Ie5d692b7b166030b2bc5c426b44608d981274cd0
---
M includes/api/ApiMain.php
1 file changed, 13 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/98/286398/1
diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php
index 07642c4..9c35292 100644
--- a/includes/api/ApiMain.php
+++ b/includes/api/ApiMain.php
@@ -1626,13 +1626,20 @@
// Fill 'datatypes' and 'credits', if applicable
if ( empty( $options['nolead'] ) ) {
+ global $wgExperimentalHtmlIds;
+
$level = $options['headerlevel'];
$tocnumber = &$options['tocnumber'];
$header = $this->msg( 'api-help-datatypes-header'
)->parse();
+
+ // Add an additional span with sanitized ID
+ if ( !$wgExperimentalHtmlIds ) {
+ $header = Html::element( 'span', [ 'id' =>
Sanitizer::escapeId( 'main/datatypes' ) ] ) .
+ $header;
+ }
$help['datatypes'] .= Html::rawElement( 'h' . min( 6,
$level ),
[ 'id' => 'main/datatypes', 'class' =>
'apihelp-header' ],
- Html::element( 'span', [ 'id' =>
Sanitizer::escapeId( 'main/datatypes' ) ] ) .
$header
);
$help['datatypes'] .= $this->msg( 'api-help-datatypes'
)->parseAsBlock();
@@ -1648,10 +1655,14 @@
];
}
+ // Add an additional span with sanitized ID
+ if ( !$wgExperimentalHtmlIds ) {
+ $header = Html::element( 'span', [ 'id' =>
Sanitizer::escapeId( 'main/credits' ) ] ) .
+ $header;
+ }
$header = $this->msg( 'api-credits-header' )->parse();
$help['credits'] .= Html::rawElement( 'h' . min( 6,
$level ),
[ 'id' => 'main/credits', 'class' =>
'apihelp-header' ],
- Html::element( 'span', [ 'id' =>
Sanitizer::escapeId( 'main/credits' ) ] ) .
$header
);
$help['credits'] .= $this->msg( 'api-credits'
)->useDatabase( false )->parseAsBlock();
--
To view, visit https://gerrit.wikimedia.org/r/286398
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie5d692b7b166030b2bc5c426b44608d981274cd0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Gerrit Patch Uploader <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits