jenkins-bot has submitted this change and it was merged. Change subject: API: Remove XML tag highlighting from non-XML formats ......................................................................
API: Remove XML tag highlighting from non-XML formats Since 926afc65c316, the transformation assumes < and > occur in pairs. This assumption is invalid for formats such as JSON. Implementing proper JSON syntax highlighting falls outside the scope of this workaround and is left for separate changes, likely including the addition of a hook. That is part of the API roadmap RfC. https://www.mediawiki.org/wiki/Requests_for_comment/API_roadmap#Changes_to_pretty-printed_HTML_formats Bug: 65403 Change-Id: Iff8d444c82f7efd2bd1c9f703defc4f0984e8211 --- M RELEASE-NOTES-1.25 M includes/api/ApiFormatBase.php 2 files changed, 9 insertions(+), 4 deletions(-) Approvals: Krinkle: Looks good to me, approved jenkins-bot: Verified diff --git a/RELEASE-NOTES-1.25 b/RELEASE-NOTES-1.25 index c8bea32..70f175b 100644 --- a/RELEASE-NOTES-1.25 +++ b/RELEASE-NOTES-1.25 @@ -25,10 +25,12 @@ === Other changes in 1.25 === * The skin autodiscovery mechanism, deprecated in MediaWiki 1.23, has been removed. See https://www.mediawiki.org/wiki/Manual:Skin_autodiscovery for - migration guide for creators and users of custom skins that relied on it. + migration guide for creators and users of custom skins that relied on it. * Javascript variable 'wgFileCanRotate' now only available on Special:Upload. * (bug 56257) Set site logo url in ResourceLoaderSiteModule instead of inline styles in the HTML output. +* (bug 65403) XML tag highlighting is now only performed for formats + "xmlfm" and "wddxfm". == Compatibility == diff --git a/includes/api/ApiFormatBase.php b/includes/api/ApiFormatBase.php index 9165ce8..2a57688 100644 --- a/includes/api/ApiFormatBase.php +++ b/includes/api/ApiFormatBase.php @@ -278,9 +278,12 @@ protected function formatHTML( $text ) { // Escape everything first for full coverage $text = htmlspecialchars( $text ); - // encode all comments or tags as safe blue strings - $text = str_replace( '<', '<span style="color:blue;"><', $text ); - $text = str_replace( '>', '></span>', $text ); + + if ( $this->mFormat === 'XML' || $this->mFormat === 'WDDX' ) { + // encode all comments or tags as safe blue strings + $text = str_replace( '<', '<span style="color:blue;"><', $text ); + $text = str_replace( '>', '></span>', $text ); + } // identify requests to api.php $text = preg_replace( '#^(\s*)(api\.php\?[^ <\n\t]+)$#m', '\1<a href="\2">\2</a>', $text ); -- To view, visit https://gerrit.wikimedia.org/r/133739 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iff8d444c82f7efd2bd1c9f703defc4f0984e8211 Gerrit-PatchSet: 9 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: PleaseStand <[email protected]> Gerrit-Reviewer: Anomie <[email protected]> Gerrit-Reviewer: Krinkle <[email protected]> Gerrit-Reviewer: MaxSem <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
