1 |
|
2 |
|
3 |
|
4 | (function(mod) {
|
5 | if (typeof exports == "object" && typeof module == "object")
|
6 | mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"),
|
7 | require("../../addon/mode/multiplex"));
|
8 | else if (typeof define == "function" && define.amd)
|
9 | define(["../../lib/codemirror", "../htmlmixed/htmlmixed",
|
10 | "../../addon/mode/multiplex"], mod);
|
11 | else
|
12 | mod(CodeMirror);
|
13 | })(function(CodeMirror) {
|
14 | "use strict";
|
15 |
|
16 | CodeMirror.defineMode("htmlembedded", function(config, parserConfig) {
|
17 | var closeComment = parserConfig.closeComment || "--%>"
|
18 | return CodeMirror.multiplexingMode(CodeMirror.getMode(config, "htmlmixed"), {
|
19 | open: parserConfig.openComment || "<%--",
|
20 | close: closeComment,
|
21 | delimStyle: "comment",
|
22 | mode: {token: function(stream) {
|
23 | stream.skipTo(closeComment) || stream.skipToEnd()
|
24 | return "comment"
|
25 | }}
|
26 | }, {
|
27 | open: parserConfig.open || parserConfig.scriptStartRegex || "<%",
|
28 | close: parserConfig.close || parserConfig.scriptEndRegex || "%>",
|
29 | mode: CodeMirror.getMode(config, parserConfig.scriptingModeSpec)
|
30 | });
|
31 | }, "htmlmixed");
|
32 |
|
33 | CodeMirror.defineMIME("application/x-ejs", {name: "htmlembedded", scriptingModeSpec:"javascript"});
|
34 | CodeMirror.defineMIME("application/x-aspx", {name: "htmlembedded", scriptingModeSpec:"text/x-csharp"});
|
35 | CodeMirror.defineMIME("application/x-jsp", {name: "htmlembedded", scriptingModeSpec:"text/x-java"});
|
36 | CodeMirror.defineMIME("application/x-erb", {name: "htmlembedded", scriptingModeSpec:"ruby"});
|
37 | });
|