| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
namespace MediaWiki\SyntaxHighlight; |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
class SyntaxHighlightAce { |
| 25 |
|
| 26 |
private static $aceLexers = [ |
| 27 |
'ABAP' => [ 'abap' ], |
| 28 |
'ABC' => [], |
| 29 |
'ActionScript' => [ 'actionscript', 'actionscript3' ], |
| 30 |
'ADA' => [ 'ada', 'ada2005', 'ada95' ], |
| 31 |
'Apache_Conf' => [ 'apache', 'apacheconf', 'aconf' ], |
| 32 |
'AsciiDoc' => [], |
| 33 |
'Assembly_x86' => [ 'nasm' ], |
| 34 |
'AutoHotKey' => [ 'autohotkey', 'ah' ], |
| 35 |
'BatchFile' => [ 'bat', 'batch', 'dosbatch', 'winbatch' ], |
| 36 |
'C_Cpp' => [ 'cpp', 'c++' ], |
| 37 |
'C9Search' => [], |
| 38 |
'Cirru' => [ 'cirru' ], |
| 39 |
'Clojure' => [ 'clojure', 'clj' ], |
| 40 |
'Cobol' => [ 'cobol' ], |
| 41 |
'coffee' => [ 'coffee', 'coffeescript', 'coffee-script' ], |
| 42 |
'ColdFusion' => [ 'cfm' ], |
| 43 |
'CSharp' => [ 'csharp', '#' ], |
| 44 |
'CSS' => [ 'css' ], |
| 45 |
'Curly' => [], |
| 46 |
'D' => [ 'd' ], |
| 47 |
'Dart' => [ 'dart' ], |
| 48 |
'Diff' => [ 'diff', 'udiff' ], |
| 49 |
'Django' => [ 'django', 'html+django', 'html+jinja', 'htmldjango' ], |
| 50 |
'Dockerfile' => [ 'Dockerfile', 'docker' ], |
| 51 |
'Dot' => [], |
| 52 |
'Dummy' => [], |
| 53 |
'DummySyntax' => [], |
| 54 |
'Eiffel' => [ 'eiffel' ], |
| 55 |
'EJS' => [], |
| 56 |
'Elixir' => [ 'elixer', 'ex', 'exs' ], |
| 57 |
'Elm' => [ 'elm' ], |
| 58 |
'Erlang' => [ 'erlang' ], |
| 59 |
'Forth' => [], |
| 60 |
'Fortran' => [ 'fortran' ], |
| 61 |
'FTL' => [], |
| 62 |
'Gcode' => [], |
| 63 |
'Gherkin' => [ 'cucumber', 'gherkin' ], |
| 64 |
'Gitignore' => [], |
| 65 |
'Glsl' => [ 'glsl' ], |
| 66 |
'Gobstones' => [], |
| 67 |
'golang' => [ 'go' ], |
| 68 |
'Groovy' => [ 'groovy' ], |
| 69 |
'HAML' => [ 'haml' ], |
| 70 |
'Handlebars' => [ 'html+handlebars' ], |
| 71 |
'Haskell' => [ 'haskell', 'hs' ], |
| 72 |
'haXe' => [ 'hx', 'haxe', 'hxsl' ], |
| 73 |
'HTML' => [ 'html' ], |
| 74 |
'HTML_Elixir' => [], |
| 75 |
'HTML_Ruby' => [ 'rhtml', 'html+erb', 'html+ruby' ], |
| 76 |
'INI' => [ 'ini', 'cfg', 'dosini' ], |
| 77 |
'Io' => [ 'io' ], |
| 78 |
'Jack' => [ '' ], |
| 79 |
'Jade' => [ 'jade' ], |
| 80 |
'Java' => [ 'java' ], |
| 81 |
'JavaScript' => [ 'Javascript', 'js' ], |
| 82 |
'JSON' => [ 'json' ], |
| 83 |
'JSONiq' => [], |
| 84 |
'JSP' => [ 'jsp' ], |
| 85 |
'JSX' => [], |
| 86 |
'Julia' => [ 'julia', 'jl' ], |
| 87 |
'LaTeX' => [ 'latex' ], |
| 88 |
'Lean' => [ 'lean' ], |
| 89 |
'LESS' => [ 'less' ], |
| 90 |
'Liquid' => [ 'liquid' ], |
| 91 |
'Lisp' => [ 'lisp', 'common-lisp', 'cl' ], |
| 92 |
'LiveScript' => [ 'Livescript', 'live-script' ], |
| 93 |
'LogiQL' => [], |
| 94 |
'LSL' => [ 'lsl' ], |
| 95 |
'Lua' => [ 'lua' ], |
| 96 |
'LuaPage' => [], |
| 97 |
'Lucene' => [], |
| 98 |
'Makefile' => [ 'make', 'makefile', 'mf', 'bsdmake' ], |
| 99 |
'Markdown' => [], |
| 100 |
'Mask' => [ 'mask' ], |
| 101 |
'MATLAB' => [ 'matlab' ], |
| 102 |
'Maze' => [], |
| 103 |
'MEL' => [], |
| 104 |
'MUSHCode' => [], |
| 105 |
'MySQL' => [ 'mysql' ], |
| 106 |
'Nix' => [ 'nix', 'nixos' ], |
| 107 |
'NSIS' => [ 'nsis', 'nsi', 'nsh' ], |
| 108 |
'ObjectiveC' => [ 'objectivec', 'objective-c', 'obj-c', 'objc', |
| 109 |
'objective-c++', 'objectivec++', 'obj-c++', 'objc++' ], |
| 110 |
'OCaml' => [ 'ocaml' ], |
| 111 |
'Pascal' => [ 'pascal', 'delphi', 'pas', 'objectpascal' ], |
| 112 |
'Perl' => [ 'perl', 'pl', 'perl6', 'pl6' ], |
| 113 |
'pgSQL' => [ 'postgresql', 'postgres' ], |
| 114 |
'PHP' => [ 'php', 'php3', 'php4', 'php5', 'html+php' ], |
| 115 |
'Powershell' => [ 'powershell', 'posh', 'ps1', 'psm1' ], |
| 116 |
'Praat' => [ 'praat' ], |
| 117 |
'Prolog' => [ 'prolog' ], |
| 118 |
'Properties' => [ 'properties', 'jproperties' ], |
| 119 |
'Protobuf' => [ 'protobuf', 'proto' ], |
| 120 |
'Python' => [ 'python', 'py', 'sage', 'python3', 'py3' ], |
| 121 |
'R' => [], |
| 122 |
'Razor' => [], |
| 123 |
'RDoc' => [], |
| 124 |
'RHTML' => [], |
| 125 |
'RST' => [ 'rst', 'rest', 'restructuredtext' ], |
| 126 |
'Ruby' => [ 'ruby', 'rb', 'duby' ], |
| 127 |
'Rust' => [ 'rust' ], |
| 128 |
'SASS' => [ 'sass' ], |
| 129 |
'SCAD' => [], |
| 130 |
'Scala' => [ 'scala' ], |
| 131 |
'Scheme' => [ 'scheme', 'scm' ], |
| 132 |
'SCSS' => [ 'scss' ], |
| 133 |
'SH' => [ 'sh', 'bash', 'ksh', 'shell' ], |
| 134 |
'SJS' => [], |
| 135 |
'Smarty' => [ 'smarty', 'html+smarty' ], |
| 136 |
'snippets' => [], |
| 137 |
'Soy_Template' => [], |
| 138 |
'Space' => [], |
| 139 |
'SQL' => [ 'sql' ], |
| 140 |
'SQLServer' => [], |
| 141 |
'Stylus' => [], |
| 142 |
'SVG' => [], |
| 143 |
'Swift' => [ 'swift' ], |
| 144 |
'Tcl' => [ 'tcl' ], |
| 145 |
'Tex' => [ 'tex' ], |
| 146 |
'Text' => [ 'text' ], |
| 147 |
'Textile' => [], |
| 148 |
'Toml' => [], |
| 149 |
'Twig' => [ 'html+twig', 'twig' ], |
| 150 |
'Typescript' => [ 'typescript', 'ts' ], |
| 151 |
'Vala' => [ 'vala', 'vapi' ], |
| 152 |
'VBScript' => [], |
| 153 |
'Velocity' => [ 'velocity', 'html+velocity' ], |
| 154 |
'Verilog' => [ 'verilog', 'v', 'systemverilog', 'sv' ], |
| 155 |
'VHDL' => [ 'vhdl' ], |
| 156 |
'Wollok' => [], |
| 157 |
'XML' => [ 'xml' ], |
| 158 |
'XQuery' => [ 'xquery', 'xqy', 'xq', 'xql', 'xqm' ], |
| 159 |
'YAML' => [ 'yaml' ], |
| 160 |
]; |
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
public static function getPygmentsToAceMap(): array { |
| 166 |
$result = []; |
| 167 |
foreach ( self::$aceLexers as $aceName => $pygmentsLexers ) { |
| 168 |
foreach ( $pygmentsLexers as $lexer ) { |
| 169 |
if ( strcasecmp( $lexer, $aceName ) === 0 ) { |
| 170 |
continue; |
| 171 |
} |
| 172 |
if ( !array_key_exists( $lexer, $result ) ) { |
| 173 |
$result[ $lexer ] = $aceName; |
| 174 |
} |
| 175 |
} |
| 176 |
} |
| 177 |
return $result; |
| 178 |
} |
| 179 |
} |