mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-11-24 00:05:00 +00:00
Add integration with CodeEditor extension.
This commit is contained in:
parent
eb6f95b6ce
commit
03bf6ce779
|
@ -52,6 +52,7 @@ $wgHooks['ParserTestTables'][] = 'ScriptingHooks::addTestTables';
|
|||
$wgHooks['CanonicalNamespaces'][] = 'ScriptingHooks::addCanonicalNamespaces';
|
||||
$wgHooks['ArticleViewCustom'][] = 'ScriptingHooks::handleScriptView';
|
||||
$wgHooks['TitleIsWikitextPage'][] = 'ScriptingHooks::isWikitextPage';
|
||||
$wgHooks['CodeEditorGetPageLanguage'][] = 'ScriptingHooks::getCodeLangauge';
|
||||
$wgHooks['EditFilter'][] = 'ScriptingHooks::validateScript';
|
||||
|
||||
$wgHooks['LinksUpdate'][] = 'ScriptLinksUpdateHooks::updateLinks';
|
||||
|
@ -90,11 +91,15 @@ $wgScriptingNamespaceNumbers = array(
|
|||
);
|
||||
|
||||
/**
|
||||
* Turn on to true if you have linked or copied wikiscripts.php and
|
||||
* SyntaxHighlight_GeSHi extension is enabled.
|
||||
* Turn on to true if SyntaxHighlight_GeSHi extension is enabled.
|
||||
*/
|
||||
$wgScriptingUseGeSHi = false;
|
||||
|
||||
/**
|
||||
* Turn on to true if CodeEditor extension is enabled.
|
||||
*/
|
||||
$wgScriptingUseCodeEditor = false;
|
||||
|
||||
function efDefineScriptingNamespace() {
|
||||
global $wgScriptingNamespaceNumbers;
|
||||
define( 'NS_MODULE', $wgScriptingNamespaceNumbers['Module'] );
|
||||
|
|
|
@ -174,11 +174,18 @@ abstract class ScriptingEngineBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the language code for GeSHi syntax highlighter.
|
||||
* Get the language for GeSHi syntax highlighter.
|
||||
*/
|
||||
function getGeSHiLangauge() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the langauge for Ace code editor.
|
||||
*/
|
||||
function getCodeEditorLanguage() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -160,6 +160,19 @@ class ScriptingHooks {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static function getCodeLangauge( $title, &$lang ) {
|
||||
global $wgParser, $wgScriptingUseCodeEditor;
|
||||
if( $wgScriptingUseCodeEditor && $title->getNamespace() == NS_MODULE ) {
|
||||
$engine = Scripting::getEngine( $wgParser );
|
||||
if( $engine->getCodeEditorLanguage() ) {
|
||||
$lang = $engine->getCodeEditorLanguage();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates that modules are not wikitext.
|
||||
|
|
|
@ -42,6 +42,10 @@ class LuaSandboxEngine extends ScriptingEngineBase {
|
|||
return 'lua';
|
||||
}
|
||||
|
||||
public function getCodeEditorLanguage() {
|
||||
return 'lua';
|
||||
}
|
||||
|
||||
public function getLimitsReport() {
|
||||
$this->load();
|
||||
|
||||
|
|
Loading…
Reference in a new issue