Merge "Expose Pygments version on Special:Version"

This commit is contained in:
jenkins-bot 2021-09-10 19:28:13 +00:00 committed by Gerrit Code Review
commit a5be55b248
2 changed files with 16 additions and 1 deletions

View file

@ -101,7 +101,8 @@
],
"ApiFormatHighlight": [
"SyntaxHighlight::onApiFormatHighlight"
]
],
"SoftwareInfo": "SyntaxHighlight::onSoftwareInfo"
},
"attributes": {
"SyntaxHighlight": {

View file

@ -558,4 +558,18 @@ class SyntaxHighlight {
// Inform MediaWiki that we have parsed this page and it shouldn't mess with it.
return false;
}
/**
* Hook to add Pygments version to Special:Version
*
* @see https://www.mediawiki.org/wiki/Manual:Hooks/SoftwareInfo
* @param array &$software
*/
public static function onSoftwareInfo( array &$software ) {
try {
$software['[https://pygments.org/ Pygments]'] = Pygmentize::getVersion();
} catch ( PygmentsException $e ) {
// pass
}
}
}