439e63a4276d09a094aac7d41e85589a7a8e199a
1 // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 // Distributed under an MIT license: https://codemirror.net/LICENSE
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
13 })(function(CodeMirror
) {
16 CodeMirror
.defineMode("htmlembedded", function(config
, parserConfig
) {
17 var closeComment
= parserConfig
.closeComment
|| "--%>"
18 return CodeMirror
.multiplexingMode(CodeMirror
.getMode(config
, "htmlmixed"), {
19 open
: parserConfig
.openComment
|| "<%--",
21 delimStyle
: "comment",
22 mode
: {token: function(stream
) {
23 stream
.skipTo(closeComment
) || stream
.skipToEnd()
27 open
: parserConfig
.open
|| parserConfig
.scriptStartRegex
|| "<%",
28 close
: parserConfig
.close
|| parserConfig
.scriptEndRegex
|| "%>",
29 mode
: CodeMirror
.getMode(config
, parserConfig
.scriptingModeSpec
)
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"});