Index: trunk/extensions/Scripting/Scripting.php |
— | — | @@ -52,6 +52,7 @@ |
53 | 53 | $wgHooks['CanonicalNamespaces'][] = 'ScriptingHooks::addCanonicalNamespaces'; |
54 | 54 | $wgHooks['ArticleViewCustom'][] = 'ScriptingHooks::handleScriptView'; |
55 | 55 | $wgHooks['TitleIsWikitextPage'][] = 'ScriptingHooks::isWikitextPage'; |
| 56 | +$wgHooks['CodeEditorGetPageLanguage'][] = 'ScriptingHooks::getCodeLangauge'; |
56 | 57 | $wgHooks['EditFilter'][] = 'ScriptingHooks::validateScript'; |
57 | 58 | |
58 | 59 | $wgHooks['LinksUpdate'][] = 'ScriptLinksUpdateHooks::updateLinks'; |
— | — | @@ -90,11 +91,15 @@ |
91 | 92 | ); |
92 | 93 | |
93 | 94 | /** |
94 | | - * Turn on to true if you have linked or copied wikiscripts.php and |
95 | | - * SyntaxHighlight_GeSHi extension is enabled. |
| 95 | + * Turn on to true if SyntaxHighlight_GeSHi extension is enabled. |
96 | 96 | */ |
97 | 97 | $wgScriptingUseGeSHi = false; |
98 | 98 | |
| 99 | +/** |
| 100 | + * Turn on to true if CodeEditor extension is enabled. |
| 101 | + */ |
| 102 | +$wgScriptingUseCodeEditor = false; |
| 103 | + |
99 | 104 | function efDefineScriptingNamespace() { |
100 | 105 | global $wgScriptingNamespaceNumbers; |
101 | 106 | define( 'NS_MODULE', $wgScriptingNamespaceNumbers['Module'] ); |
Index: trunk/extensions/Scripting/common/Base.php |
— | — | @@ -174,11 +174,18 @@ |
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
178 | | - * Get the language code for GeSHi syntax highlighter. |
| 178 | + * Get the language for GeSHi syntax highlighter. |
179 | 179 | */ |
180 | 180 | function getGeSHiLangauge() { |
181 | 181 | return false; |
182 | 182 | } |
| 183 | + |
| 184 | + /** |
| 185 | + * Get the langauge for Ace code editor. |
| 186 | + */ |
| 187 | + function getCodeEditorLanguage() { |
| 188 | + return false; |
| 189 | + } |
183 | 190 | } |
184 | 191 | |
185 | 192 | /** |
Index: trunk/extensions/Scripting/common/Hooks.php |
— | — | @@ -160,6 +160,19 @@ |
161 | 161 | return true; |
162 | 162 | } |
163 | 163 | } |
| 164 | + |
| 165 | + public static function getCodeLangauge( $title, &$lang ) { |
| 166 | + global $wgParser, $wgScriptingUseCodeEditor; |
| 167 | + if( $wgScriptingUseCodeEditor && $title->getNamespace() == NS_MODULE ) { |
| 168 | + $engine = Scripting::getEngine( $wgParser ); |
| 169 | + if( $engine->getCodeEditorLanguage() ) { |
| 170 | + $lang = $engine->getCodeEditorLanguage(); |
| 171 | + return false; |
| 172 | + } |
| 173 | + } |
| 174 | + |
| 175 | + return true; |
| 176 | + } |
164 | 177 | |
165 | 178 | /** |
166 | 179 | * Indicates that modules are not wikitext. |
Index: trunk/extensions/Scripting/engines/LuaSandbox/Engine.php |
— | — | @@ -42,6 +42,10 @@ |
43 | 43 | return 'lua'; |
44 | 44 | } |
45 | 45 | |
| 46 | + public function getCodeEditorLanguage() { |
| 47 | + return 'lua'; |
| 48 | + } |
| 49 | + |
46 | 50 | public function getLimitsReport() { |
47 | 51 | $this->load(); |
48 | 52 | |