mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-27 15:40:00 +00:00
Add tags from CodeMirrorPluginModules to extension tags list
Currently, only registered parser tags are included in the list of extension tags to be highlighted. This patch allows extensions that do not register their tags as parser tags (Extension:Translate) to still define them for highlighting using the existing CodeMirrorPluginModules annotation. This patch also removes the special-casing for <translate>, as it can be defined in Translate instead. Bug: T284883 Co-Authored-by: Tacsipacsi <tacsipacsi@jnet.hu> Depends-On: I860c944eaeeb7771629a1ed2352c05cfd8d7ca80 Change-Id: Iba2b0b874ebbace7a892af9e1d9896e8b17ade78
This commit is contained in:
parent
56f6731968
commit
b136622875
|
@ -64,11 +64,14 @@ class ResourceLoaderCodeMirrorModule extends ResourceLoaderFileModule {
|
|||
$registry = ExtensionRegistry::getInstance();
|
||||
$parser = MediaWikiServices::getInstance()->getParser();
|
||||
|
||||
$tagModes = $registry->getAttribute( 'CodeMirrorTagModes' );
|
||||
$tagNames = array_merge( $parser->getTags(), array_keys( $tagModes ) );
|
||||
|
||||
// initialize configuration
|
||||
$config = [
|
||||
'pluginModules' => $registry->getAttribute( 'CodeMirrorPluginModules' ),
|
||||
'tagModes' => $registry->getAttribute( 'CodeMirrorTagModes' ),
|
||||
'tags' => array_fill_keys( $parser->getTags(), true ),
|
||||
'tagModes' => $tagModes,
|
||||
'tags' => array_fill_keys( $tagNames, true ),
|
||||
'doubleUnderscore' => [ [], [] ],
|
||||
'functionSynonyms' => $parser->getFunctionSynonyms(),
|
||||
'urlProtocols' => $parser->getUrlProtocols(),
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
rp: true, rt: true, rtc: true, p: true, span: true, abbr: true, dfn: true,
|
||||
kbd: true, samp: true, data: true, time: true, mark: true, br: true,
|
||||
wbr: true, hr: true, li: true, dt: true, dd: true, td: true, th: true,
|
||||
tr: true, noinclude: true, includeonly: true, onlyinclude: true, translate: true },
|
||||
tr: true, noinclude: true, includeonly: true, onlyinclude: true },
|
||||
voidHtmlTags = { br: true, hr: true, wbr: true },
|
||||
isBold, isItalic, firstsingleletterword, firstmultiletterword, firstspace, mBold, mItalic, mTokens = [],
|
||||
mStyle;
|
||||
|
|
Loading…
Reference in a new issue