[MediaWiki-commits] [Gerrit] mediawiki...SyntaxHighlight_GeSHi[master]: Convert SyntaxHighlight names to Ace names
jenkins-bot has submitted this change and it was merged. Change subject: Convert SyntaxHighlight names to Ace names .. Convert SyntaxHighlight names to Ace names Provide a translation from Syntaxhighlight compatible Pygments and GeSHi language names to CodeEditor compatible Ace lexer names Now when you select php4, the CodeEditor will use the Ace lexer php, instead of falling back to text mode. Bug: T148515 Change-Id: Ibc209f97318614f764457726f8d55f4e15276d79 --- M ResourceLoaderGeSHiVisualEditorModule.php A SyntaxHighlight_GeSHi.ace.php M extension.json M modules/ve-syntaxhighlight/ve.dm.MWSyntaxHighlightNode.js M modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightDialog.js 5 files changed, 229 insertions(+), 9 deletions(-) Approvals: Jforrester: Looks good to me, approved jenkins-bot: Verified diff --git a/ResourceLoaderGeSHiVisualEditorModule.php b/ResourceLoaderGeSHiVisualEditorModule.php index 123fcd1..64c1e41 100644 --- a/ResourceLoaderGeSHiVisualEditorModule.php +++ b/ResourceLoaderGeSHiVisualEditorModule.php @@ -29,8 +29,18 @@ $scripts = parent::getScript( $context ); return $scripts . Xml::encodeJsCall( - 've.dm.MWSyntaxHighlightNode.static.addLanguages', array( - $this->getLanguages() + 've.dm.MWSyntaxHighlightNode.static.addPygmentsLanguages', array( + $this->getPygmentsLanguages() + ), + ResourceLoader::inDebugMode() + ) . Xml::encodeJsCall( + 've.dm.MWSyntaxHighlightNode.static.addGeshiToPygmentsMap', array( + GeSHi::$compatibleLexers + ), + ResourceLoader::inDebugMode() + ) . Xml::encodeJsCall( + 've.dm.MWSyntaxHighlightNode.static.addPygmentsToAceMap', array( + SyntaxHighlightAce::getPygmentsToAceMap() ), ResourceLoader::inDebugMode() ); @@ -47,9 +57,9 @@ * Get a full list of available langauges * @return array */ - private function getLanguages() { + private function getPygmentsLanguages() { $lexers = require __DIR__ . '/SyntaxHighlight_GeSHi.lexers.php'; - return array_merge( $lexers, array_keys( GeSHi::$compatibleLexers ) ); + return $lexers; } public function enableModuleContentVersion() { diff --git a/SyntaxHighlight_GeSHi.ace.php b/SyntaxHighlight_GeSHi.ace.php new file mode 100644 index 000..d01ca1b --- /dev/null +++ b/SyntaxHighlight_GeSHi.ace.php @@ -0,0 +1,175 @@ +http://www.gnu.org/copyleft/gpl.html + */ + +/** + * Class provides functionality to map Ace lexer definitions + */ +class SyntaxHighlightAce +{ + /** @var array This map is inverted, because it is easier to maintain this way */ + private static $aceLexers = [ + 'ABAP' => [ 'abap' ], + 'ABC' => [], + 'ActionScript' => [ 'actionscript', 'actionscript3' ], + 'ADA' => [ 'ada', 'ada2005', 'ada95' ], + 'Apache_Conf' => [ 'apache', 'apacheconf', 'aconf'], + 'AsciiDoc' => [], + 'Assembly_x86' => [ 'nasm' ], + 'AutoHotKey' => [ 'autohotkey', 'ah' ], + 'BatchFile'=> [ 'bat', 'batch', 'dosbatch', 'winbatch' ], + 'C_Cpp'=> [ 'cpp', 'c++' ], + 'C9Search' => [], + 'Cirru'=> [ 'cirru' ], + 'Clojure' => [ 'clojure', 'clj' ], + 'Cobol'=> [ 'cobol' ], + 'coffee' => [ 'coffee', 'coffeescript', 'coffee-script' ], + 'ColdFusion' => [ 'cfm' ], + 'CSharp' => [ 'csharp', '#' ], + 'CSS' => [ 'css' ], + 'Curly'=> [], + 'D'=> [ 'd' ], + 'Dart' => [ 'dart' ], + 'Diff' => [ 'diff', 'udiff' ], + 'Django' => [ 'django', 'html+django', 'html+jinja', 'htmldjango'], + 'Dockerfile' => [ 'Dockerfile', 'docker' ], + 'Dot' => [], + 'Dummy'=> [], + 'DummySyntax' => [], + 'Eiffel' => [ 'eiffel' ], + 'EJS' => [], + 'Elixir' => [ 'elixer', 'ex', 'exs' ], + 'Elm' => [ 'elm' ], + 'Erlang' => [ 'erlang' ], + 'Forth'=> [], + 'Fortran' => [ 'fortran' ], + 'FTL' => [], + 'Gcode'=> [], + 'Gherkin' => [ 'cucumber', 'gherkin'
[MediaWiki-commits] [Gerrit] mediawiki...SyntaxHighlight_GeSHi[master]: Convert SyntaxHighlight names to Ace names
TheDJ has uploaded a new change for review. https://gerrit.wikimedia.org/r/317150 Change subject: Convert SyntaxHighlight names to Ace names .. Convert SyntaxHighlight names to Ace names Provide a translation from Syntaxhighlight compatible Pygments and GeSHi language names to CodeEditor compatible Ace lexer names Now when you select php4, the CodeEditor will use the Ace lexer php, instead of falling back to text mode. Bug: T148515 Change-Id: Ibc209f97318614f764457726f8d55f4e15276d79 --- M ResourceLoaderGeSHiVisualEditorModule.php A SyntaxHighlight_GeSHi.ace.php M extension.json M modules/ve-syntaxhighlight/ve.dm.MWSyntaxHighlightNode.js M modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightDialog.js 5 files changed, 228 insertions(+), 9 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SyntaxHighlight_GeSHi refs/changes/50/317150/1 diff --git a/ResourceLoaderGeSHiVisualEditorModule.php b/ResourceLoaderGeSHiVisualEditorModule.php index 123fcd1..64c1e41 100644 --- a/ResourceLoaderGeSHiVisualEditorModule.php +++ b/ResourceLoaderGeSHiVisualEditorModule.php @@ -29,8 +29,18 @@ $scripts = parent::getScript( $context ); return $scripts . Xml::encodeJsCall( - 've.dm.MWSyntaxHighlightNode.static.addLanguages', array( - $this->getLanguages() + 've.dm.MWSyntaxHighlightNode.static.addPygmentsLanguages', array( + $this->getPygmentsLanguages() + ), + ResourceLoader::inDebugMode() + ) . Xml::encodeJsCall( + 've.dm.MWSyntaxHighlightNode.static.addGeshiToPygmentsMap', array( + GeSHi::$compatibleLexers + ), + ResourceLoader::inDebugMode() + ) . Xml::encodeJsCall( + 've.dm.MWSyntaxHighlightNode.static.addPygmentsToAceMap', array( + SyntaxHighlightAce::getPygmentsToAceMap() ), ResourceLoader::inDebugMode() ); @@ -47,9 +57,9 @@ * Get a full list of available langauges * @return array */ - private function getLanguages() { + private function getPygmentsLanguages() { $lexers = require __DIR__ . '/SyntaxHighlight_GeSHi.lexers.php'; - return array_merge( $lexers, array_keys( GeSHi::$compatibleLexers ) ); + return $lexers; } public function enableModuleContentVersion() { diff --git a/SyntaxHighlight_GeSHi.ace.php b/SyntaxHighlight_GeSHi.ace.php new file mode 100644 index 000..2d358ea --- /dev/null +++ b/SyntaxHighlight_GeSHi.ace.php @@ -0,0 +1,174 @@ +http://www.gnu.org/copyleft/gpl.html + */ + +/** + * Class provides functionality to map Ace lexer definitions + */ +class SyntaxHighlightAce + { + /** @var array This map is inverted, because it is easier to maintain this way */ + private static $aceLexers = [ + 'ABAP' => [ 'abap' ], + 'ABC' => [], + 'ActionScript' => [ 'actionscript', 'actionscript3' ], + 'ADA' => [ 'ada', 'ada2005', 'ada95' ], + 'Apache_Conf' => [ 'apache', 'apacheconf', 'aconf'], + 'AsciiDoc' => [], + 'Assembly_x86' => [ 'nasm' ], + 'AutoHotKey'=> [ 'autohotkey', 'ah' ], + 'BatchFile' => [ 'bat', 'batch', 'dosbatch', 'winbatch' ], + 'C_Cpp' => [ 'cpp', 'c++' ], + 'C9Search' => [], + 'Cirru' => [ 'cirru' ], + 'Clojure' => [ 'clojure', 'clj' ], + 'Cobol' => [ 'cobol' ], + 'coffee'=> [ 'coffee', 'coffeescript', 'coffee-script' ], + 'ColdFusion'=> [ 'cfm' ], + 'CSharp'=> [ 'csharp', '#' ], + 'CSS' => [ 'css' ], + 'Curly' => [], + 'D' => [ 'd' ], + 'Dart' => [ 'dart' ], + 'Diff' => [ 'diff', 'udiff' ], + 'Dockerfile'=> [ 'Dockerfile', 'docker' ], + 'Dot' => [], + 'Dummy' => [], + 'DummySyntax' => [], + 'Eiffel'=> [ 'eiffel' ], + 'EJS' => [], + 'Elixir'=> [ 'eli