r110796 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110795‎ | r110796 | r110797 >
Date:22:14, 6 February 2012
Author:vvv
Status:deferred
Tags:
Comment:
Add integration with CodeEditor extension.
Modified paths:
  • /trunk/extensions/Scripting/Scripting.php (modified) (history)
  • /trunk/extensions/Scripting/common/Base.php (modified) (history)
  • /trunk/extensions/Scripting/common/Hooks.php (modified) (history)
  • /trunk/extensions/Scripting/engines/LuaSandbox/Engine.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Scripting/Scripting.php
@@ -52,6 +52,7 @@
5353 $wgHooks['CanonicalNamespaces'][] = 'ScriptingHooks::addCanonicalNamespaces';
5454 $wgHooks['ArticleViewCustom'][] = 'ScriptingHooks::handleScriptView';
5555 $wgHooks['TitleIsWikitextPage'][] = 'ScriptingHooks::isWikitextPage';
 56+$wgHooks['CodeEditorGetPageLanguage'][] = 'ScriptingHooks::getCodeLangauge';
5657 $wgHooks['EditFilter'][] = 'ScriptingHooks::validateScript';
5758
5859 $wgHooks['LinksUpdate'][] = 'ScriptLinksUpdateHooks::updateLinks';
@@ -90,11 +91,15 @@
9192 );
9293
9394 /**
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.
9696 */
9797 $wgScriptingUseGeSHi = false;
9898
 99+/**
 100+ * Turn on to true if CodeEditor extension is enabled.
 101+ */
 102+$wgScriptingUseCodeEditor = false;
 103+
99104 function efDefineScriptingNamespace() {
100105 global $wgScriptingNamespaceNumbers;
101106 define( 'NS_MODULE', $wgScriptingNamespaceNumbers['Module'] );
Index: trunk/extensions/Scripting/common/Base.php
@@ -174,11 +174,18 @@
175175 }
176176
177177 /**
178 - * Get the language code for GeSHi syntax highlighter.
 178+ * Get the language for GeSHi syntax highlighter.
179179 */
180180 function getGeSHiLangauge() {
181181 return false;
182182 }
 183+
 184+ /**
 185+ * Get the langauge for Ace code editor.
 186+ */
 187+ function getCodeEditorLanguage() {
 188+ return false;
 189+ }
183190 }
184191
185192 /**
Index: trunk/extensions/Scripting/common/Hooks.php
@@ -160,6 +160,19 @@
161161 return true;
162162 }
163163 }
 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+ }
164177
165178 /**
166179 * Indicates that modules are not wikitext.
Index: trunk/extensions/Scripting/engines/LuaSandbox/Engine.php
@@ -42,6 +42,10 @@
4343 return 'lua';
4444 }
4545
 46+ public function getCodeEditorLanguage() {
 47+ return 'lua';
 48+ }
 49+
4650 public function getLimitsReport() {
4751 $this->load();
4852

Status & tagging log