| OLD | NEW |
| 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 else if (typeof define == "function" && define.amd) // AMD |
| 8 define(["../../lib/codemirror", "../htmlmixed/htmlmixed"], mod); |
| 9 else // Plain browser env |
| 10 mod(CodeMirror); |
| 11 })(function(CodeMirror) { |
| 12 "use strict"; |
| 13 |
| 1 CodeMirror.defineMode("htmlembedded", function(config, parserConfig) { | 14 CodeMirror.defineMode("htmlembedded", function(config, parserConfig) { |
| 2 | 15 |
| 3 //config settings | 16 //config settings |
| 4 var scriptStartRegex = parserConfig.scriptStartRegex || /^<%/i, | 17 var scriptStartRegex = parserConfig.scriptStartRegex || /^<%/i, |
| 5 scriptEndRegex = parserConfig.scriptEndRegex || /^%>/i; | 18 scriptEndRegex = parserConfig.scriptEndRegex || /^%>/i; |
| 6 | 19 |
| 7 //inner modes | 20 //inner modes |
| 8 var scriptingMode, htmlMixedMode; | 21 var scriptingMode, htmlMixedMode; |
| 9 | 22 |
| 10 //tokenizer when in html mode | 23 //tokenizer when in html mode |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 }, | 64 }, |
| 52 | 65 |
| 53 copyState: function(state) { | 66 copyState: function(state) { |
| 54 return { | 67 return { |
| 55 token : state.token, | 68 token : state.token, |
| 56 htmlState : CodeMirror.copyState(htmlMixedMode, state.htmlState), | 69 htmlState : CodeMirror.copyState(htmlMixedMode, state.htmlState), |
| 57 scriptState : CodeMirror.copyState(scriptingMode, state.scriptState) | 70 scriptState : CodeMirror.copyState(scriptingMode, state.scriptState) |
| 58 }; | 71 }; |
| 59 }, | 72 }, |
| 60 | 73 |
| 61 electricChars: "/{}:", | |
| 62 | |
| 63 innerMode: function(state) { | 74 innerMode: function(state) { |
| 64 if (state.token == scriptingDispatch) return {state: state.scriptState, mo
de: scriptingMode}; | 75 if (state.token == scriptingDispatch) return {state: state.scriptState, mo
de: scriptingMode}; |
| 65 else return {state: state.htmlState, mode: htmlMixedMode}; | 76 else return {state: state.htmlState, mode: htmlMixedMode}; |
| 66 } | 77 } |
| 67 }; | 78 }; |
| 68 }, "htmlmixed"); | 79 }, "htmlmixed"); |
| 69 | 80 |
| 70 CodeMirror.defineMIME("application/x-ejs", { name: "htmlembedded", scriptingMode
Spec:"javascript"}); | 81 CodeMirror.defineMIME("application/x-ejs", { name: "htmlembedded", scriptingMode
Spec:"javascript"}); |
| 71 CodeMirror.defineMIME("application/x-aspx", { name: "htmlembedded", scriptingMod
eSpec:"text/x-csharp"}); | 82 CodeMirror.defineMIME("application/x-aspx", { name: "htmlembedded", scriptingMod
eSpec:"text/x-csharp"}); |
| 72 CodeMirror.defineMIME("application/x-jsp", { name: "htmlembedded", scriptingMode
Spec:"text/x-java"}); | 83 CodeMirror.defineMIME("application/x-jsp", { name: "htmlembedded", scriptingMode
Spec:"text/x-java"}); |
| 73 CodeMirror.defineMIME("application/x-erb", { name: "htmlembedded", scriptingMode
Spec:"ruby"}); | 84 CodeMirror.defineMIME("application/x-erb", { name: "htmlembedded", scriptingMode
Spec:"ruby"}); |
| 85 |
| 86 }); |
| OLD | NEW |