From fa20f69cf4cc92804b1df788bcc67ea74d3c3542 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Thu, 18 Feb 2021 04:59:40 +0000 Subject: [PATCH] SyntaxHighlightVisualEditorModule: Use Context::encodeJson() instead Also fixes the Phan warning about Xml::encodeJsCall/FormatJson needing booleaen where int inDebugMode() is passed. Change-Id: Id8de16ab683948eae096b43462118ea837f53038 --- ...oaderSyntaxHighlightVisualEditorModule.php | 27 +++++++------------ 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/includes/ResourceLoaderSyntaxHighlightVisualEditorModule.php b/includes/ResourceLoaderSyntaxHighlightVisualEditorModule.php index 28389b1a..060750ca 100644 --- a/includes/ResourceLoaderSyntaxHighlightVisualEditorModule.php +++ b/includes/ResourceLoaderSyntaxHighlightVisualEditorModule.php @@ -26,23 +26,16 @@ class ResourceLoaderSyntaxHighlightVisualEditorModule extends ResourceLoaderFile */ public function getScript( ResourceLoaderContext $context ) { $scripts = parent::getScript( $context ); - - return $scripts . Xml::encodeJsCall( - 've.dm.MWSyntaxHighlightNode.static.addPygmentsLanguages', [ - $this->getPygmentsLanguages() - ], - ResourceLoader::inDebugMode() - ) . Xml::encodeJsCall( - 've.dm.MWSyntaxHighlightNode.static.addGeshiToPygmentsMap', [ - SyntaxHighlightGeSHiCompat::getGeSHiToPygmentsMap() - ], - ResourceLoader::inDebugMode() - ) . Xml::encodeJsCall( - 've.dm.MWSyntaxHighlightNode.static.addPygmentsToAceMap', [ - SyntaxHighlightAce::getPygmentsToAceMap() - ], - ResourceLoader::inDebugMode() - ); + return $scripts + . 've.dm.MWSyntaxHighlightNode.static.addPygmentsLanguages(' + . $context->encodeJson( $this->getPygmentsLanguages() ) + . ');' + . 've.dm.MWSyntaxHighlightNode.static.addGeshiToPygmentsMap(' + . $context->encodeJson( SyntaxHighlightGeSHiCompat::getGeSHiToPygmentsMap() ) + . ');' + . 've.dm.MWSyntaxHighlightNode.static.addPygmentsToAceMap(' + . $context->encodeJson( SyntaxHighlightAce::getPygmentsToAceMap() ) + . ');'; } /**