Expose Pygments version on Special:Version

Change-Id: Ia4eccc4f16873b16e106c8196d7582ca5b27b365
This commit is contained in:
Kunal Mehta 2021-09-02 19:35:45 -07:00
parent af6654e5f9
commit b8a5dd08ee
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
}
}
}