GPQAPP
37 строк · 1.7 Кб
1// CodeMirror, copyright (c) by Marijn Haverbeke and others
2// Distributed under an MIT license: https://codemirror.net/LICENSE
3
4(function(mod) {5if (typeof exports == "object" && typeof module == "object") // CommonJS6mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"),7require("../../addon/mode/multiplex"));8else if (typeof define == "function" && define.amd) // AMD9define(["../../lib/codemirror", "../htmlmixed/htmlmixed",10"../../addon/mode/multiplex"], mod);11else // Plain browser env12mod(CodeMirror);13})(function(CodeMirror) {14"use strict";15
16CodeMirror.defineMode("htmlembedded", function(config, parserConfig) {17var closeComment = parserConfig.closeComment || "--%>"18return CodeMirror.multiplexingMode(CodeMirror.getMode(config, "htmlmixed"), {19open: parserConfig.openComment || "<%--",20close: closeComment,21delimStyle: "comment",22mode: {token: function(stream) {23stream.skipTo(closeComment) || stream.skipToEnd()24return "comment"25}}26}, {27open: parserConfig.open || parserConfig.scriptStartRegex || "<%",28close: parserConfig.close || parserConfig.scriptEndRegex || "%>",29mode: CodeMirror.getMode(config, parserConfig.scriptingModeSpec)30});31}, "htmlmixed");32
33CodeMirror.defineMIME("application/x-ejs", {name: "htmlembedded", scriptingModeSpec:"javascript"});34CodeMirror.defineMIME("application/x-aspx", {name: "htmlembedded", scriptingModeSpec:"text/x-csharp"});35CodeMirror.defineMIME("application/x-jsp", {name: "htmlembedded", scriptingModeSpec:"text/x-java"});36CodeMirror.defineMIME("application/x-erb", {name: "htmlembedded", scriptingModeSpec:"ruby"});37});38