diff options
author | Cheng-Han, Wu | 2016-04-20 18:11:40 +0800 |
---|---|---|
committer | Cheng-Han, Wu | 2016-04-20 18:11:40 +0800 |
commit | 8bf516263c6582771e7576e8484ca8cfaa8cb9cb (patch) | |
tree | aba81172f554a50466a762db99f25e3650d7ff45 /public/vendor/codemirror/mode/twig | |
parent | edc3a31dfdb03e910d7355144280e281eeb582d5 (diff) |
Update CodeMirror to 5.13.5
Diffstat (limited to 'public/vendor/codemirror/mode/twig')
-rw-r--r-- | public/vendor/codemirror/mode/twig/twig.js | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/public/vendor/codemirror/mode/twig/twig.js b/public/vendor/codemirror/mode/twig/twig.js index aa676dc4..1f2854be 100644 --- a/public/vendor/codemirror/mode/twig/twig.js +++ b/public/vendor/codemirror/mode/twig/twig.js @@ -3,15 +3,15 @@ (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror")); + mod(require("../../lib/codemirror"), require("../../addon/mode/multiplex")); else if (typeof define == "function" && define.amd) // AMD - define(["../../lib/codemirror"], mod); + define(["../../lib/codemirror", "../../addon/mode/multiplex"], mod); else // Plain browser env mod(CodeMirror); })(function(CodeMirror) { "use strict"; - CodeMirror.defineMode("twig", function() { + CodeMirror.defineMode("twig:inner", function() { var keywords = ["and", "as", "autoescape", "endautoescape", "block", "do", "endblock", "else", "elseif", "extends", "for", "endfor", "embed", "endembed", "filter", "endfilter", "flush", "from", "if", "endif", "in", "is", "include", "import", "not", "or", "set", "spaceless", "endspaceless", "with", "endwith", "trans", "endtrans", "blocktrans", "endblocktrans", "macro", "endmacro", "use", "verbatim", "endverbatim"], operator = /^[+\-*&%=<>!?|~^]/, sign = /^[:\[\(\{]/, @@ -128,5 +128,14 @@ }; }); + CodeMirror.defineMode("twig", function(config, parserConfig) { + var twigInner = CodeMirror.getMode(config, "twig:inner"); + if (!parserConfig || !parserConfig.base) return twigInner; + return CodeMirror.multiplexingMode( + CodeMirror.getMode(config, parserConfig.base), { + open: /\{[{#%]/, close: /[}#%]\}/, mode: twigInner, parseDelimiters: true + } + ); + }); CodeMirror.defineMIME("text/x-twig", "twig"); }); |