| Index: third_party/WebKit/Source/devtools/front_end/cm/htmlembedded.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/cm/htmlembedded.js b/third_party/WebKit/Source/devtools/front_end/cm/htmlembedded.js
|
| index e8f7ba803f64fe3d2986f3797dc91e6e0a7eceb4..464dc57f83870244ac3dca6382d7ad64c6d09fe3 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/cm/htmlembedded.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/cm/htmlembedded.js
|
| @@ -3,84 +3,26 @@
|
|
|
| (function(mod) {
|
| if (typeof exports == "object" && typeof module == "object") // CommonJS
|
| - mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"));
|
| + mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"),
|
| + require("../../addon/mode/multiplex"));
|
| else if (typeof define == "function" && define.amd) // AMD
|
| - define(["../../lib/codemirror", "../htmlmixed/htmlmixed"], mod);
|
| + define(["../../lib/codemirror", "../htmlmixed/htmlmixed",
|
| + "../../addon/mode/multiplex"], mod);
|
| else // Plain browser env
|
| mod(CodeMirror);
|
| })(function(CodeMirror) {
|
| -"use strict";
|
| -
|
| -CodeMirror.defineMode("htmlembedded", function(config, parserConfig) {
|
| -
|
| - //config settings
|
| - var scriptStartRegex = parserConfig.scriptStartRegex || /^<%/i,
|
| - scriptEndRegex = parserConfig.scriptEndRegex || /^%>/i;
|
| -
|
| - //inner modes
|
| - var scriptingMode, htmlMixedMode;
|
| -
|
| - //tokenizer when in html mode
|
| - function htmlDispatch(stream, state) {
|
| - if (stream.match(scriptStartRegex, false)) {
|
| - state.token=scriptingDispatch;
|
| - return scriptingMode.token(stream, state.scriptState);
|
| - }
|
| - else
|
| - return htmlMixedMode.token(stream, state.htmlState);
|
| - }
|
| -
|
| - //tokenizer when in scripting mode
|
| - function scriptingDispatch(stream, state) {
|
| - if (stream.match(scriptEndRegex, false)) {
|
| - state.token=htmlDispatch;
|
| - return htmlMixedMode.token(stream, state.htmlState);
|
| - }
|
| - else
|
| - return scriptingMode.token(stream, state.scriptState);
|
| - }
|
| -
|
| -
|
| - return {
|
| - startState: function() {
|
| - scriptingMode = scriptingMode || CodeMirror.getMode(config, parserConfig.scriptingModeSpec);
|
| - htmlMixedMode = htmlMixedMode || CodeMirror.getMode(config, "htmlmixed");
|
| - return {
|
| - token : parserConfig.startOpen ? scriptingDispatch : htmlDispatch,
|
| - htmlState : CodeMirror.startState(htmlMixedMode),
|
| - scriptState : CodeMirror.startState(scriptingMode)
|
| - };
|
| - },
|
| -
|
| - token: function(stream, state) {
|
| - return state.token(stream, state);
|
| - },
|
| -
|
| - indent: function(state, textAfter) {
|
| - if (state.token == htmlDispatch)
|
| - return htmlMixedMode.indent(state.htmlState, textAfter);
|
| - else if (scriptingMode.indent)
|
| - return scriptingMode.indent(state.scriptState, textAfter);
|
| - },
|
| -
|
| - copyState: function(state) {
|
| - return {
|
| - token : state.token,
|
| - htmlState : CodeMirror.copyState(htmlMixedMode, state.htmlState),
|
| - scriptState : CodeMirror.copyState(scriptingMode, state.scriptState)
|
| - };
|
| - },
|
| -
|
| - innerMode: function(state) {
|
| - if (state.token == scriptingDispatch) return {state: state.scriptState, mode: scriptingMode};
|
| - else return {state: state.htmlState, mode: htmlMixedMode};
|
| - }
|
| - };
|
| -}, "htmlmixed");
|
| -
|
| -CodeMirror.defineMIME("application/x-ejs", { name: "htmlembedded", scriptingModeSpec:"javascript"});
|
| -CodeMirror.defineMIME("application/x-aspx", { name: "htmlembedded", scriptingModeSpec:"text/x-csharp"});
|
| -CodeMirror.defineMIME("application/x-jsp", { name: "htmlembedded", scriptingModeSpec:"text/x-java"});
|
| -CodeMirror.defineMIME("application/x-erb", { name: "htmlembedded", scriptingModeSpec:"ruby"});
|
| -
|
| + "use strict";
|
| +
|
| + CodeMirror.defineMode("htmlembedded", function(config, parserConfig) {
|
| + return CodeMirror.multiplexingMode(CodeMirror.getMode(config, "htmlmixed"), {
|
| + open: parserConfig.open || parserConfig.scriptStartRegex || "<%",
|
| + close: parserConfig.close || parserConfig.scriptEndRegex || "%>",
|
| + mode: CodeMirror.getMode(config, parserConfig.scriptingModeSpec)
|
| + });
|
| + }, "htmlmixed");
|
| +
|
| + CodeMirror.defineMIME("application/x-ejs", {name: "htmlembedded", scriptingModeSpec:"javascript"});
|
| + CodeMirror.defineMIME("application/x-aspx", {name: "htmlembedded", scriptingModeSpec:"text/x-csharp"});
|
| + CodeMirror.defineMIME("application/x-jsp", {name: "htmlembedded", scriptingModeSpec:"text/x-java"});
|
| + CodeMirror.defineMIME("application/x-erb", {name: "htmlembedded", scriptingModeSpec:"ruby"});
|
| });
|
|
|