| 5 |
lars |
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
|
|
2 |
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
|
|
3 |
|
|
|
4 |
(function(mod) {
|
|
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
|
|
6 |
mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"),
|
|
|
7 |
require("../../addon/mode/multiplex"));
|
|
|
8 |
else if (typeof define == "function" && define.amd) // AMD
|
|
|
9 |
define(["../../lib/codemirror", "../htmlmixed/htmlmixed",
|
|
|
10 |
"../../addon/mode/multiplex"], mod);
|
|
|
11 |
else // Plain browser env
|
|
|
12 |
mod(CodeMirror);
|
|
|
13 |
})(function(CodeMirror) {
|
|
|
14 |
"use strict";
|
|
|
15 |
|
|
|
16 |
CodeMirror.defineMode("htmlembedded", function(config, parserConfig) {
|
|
|
17 |
return CodeMirror.multiplexingMode(CodeMirror.getMode(config, "htmlmixed"), {
|
|
|
18 |
open: parserConfig.open || parserConfig.scriptStartRegex || "<%",
|
|
|
19 |
close: parserConfig.close || parserConfig.scriptEndRegex || "%>",
|
|
|
20 |
mode: CodeMirror.getMode(config, parserConfig.scriptingModeSpec)
|
|
|
21 |
});
|
|
|
22 |
}, "htmlmixed");
|
|
|
23 |
|
|
|
24 |
CodeMirror.defineMIME("application/x-ejs", {name: "htmlembedded", scriptingModeSpec:"javascript"});
|
|
|
25 |
CodeMirror.defineMIME("application/x-aspx", {name: "htmlembedded", scriptingModeSpec:"text/x-csharp"});
|
|
|
26 |
CodeMirror.defineMIME("application/x-jsp", {name: "htmlembedded", scriptingModeSpec:"text/x-java"});
|
|
|
27 |
CodeMirror.defineMIME("application/x-erb", {name: "htmlembedded", scriptingModeSpec:"ruby"});
|
|
|
28 |
});
|