1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-30 02:29:43 +02:00

Update CodeMirror dep to v5.42.2

Affects Code and Markdown section types
This commit is contained in:
Harvey Kandola 2019-01-08 14:48:23 +00:00
parent c706edec47
commit 479a61a3ef
347 changed files with 21845 additions and 20770 deletions

View file

@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@ -149,11 +149,13 @@
return "string";
}
if (stream.match(/^\/\*/)) {
state.soyState.push("comment");
return "comment";
} else if (stream.match(stream.sol() || (state.soyState.length && last(state.soyState) != "literal") ? /^\s*\/\/.*/ : /^\s+\/\/.*/)) {
return "comment";
if (!state.soyState.length || last(state.soyState) != "literal") {
if (stream.match(/^\/\*/)) {
state.soyState.push("comment");
return "comment";
} else if (stream.match(stream.sol() ? /^\s*\/\/.*/ : /^\s+\/\/.*/)) {
return "comment";
}
}
switch (last(state.soyState)) {
@ -168,11 +170,11 @@
return null;
case "templ-ref":
if (match = stream.match(/^\.?([\w]+)/)) {
if (match = stream.match(/(\.?[a-zA-Z_][a-zA-Z_0-9]+)+/)) {
state.soyState.pop();
// If the first character is '.', try to match against a local template name.
// If the first character is '.', it can only be a local template.
if (match[0][0] == '.') {
return ref(state.templates, match[1], true);
return "variable-2"
}
// Otherwise
return "variable";
@ -180,6 +182,14 @@
stream.next();
return null;
case "namespace-def":
if (match = stream.match(/^\.?([\w\.]+)/)) {
state.soyState.pop();
return "variable";
}
stream.next();
return null;
case "param-def":
if (match = stream.match(/^\w+/)) {
state.variables = prepend(state.variables, match[0]);
@ -190,13 +200,21 @@
stream.next();
return null;
case "param-ref":
if (match = stream.match(/^\w+/)) {
state.soyState.pop();
return "property";
}
stream.next();
return null;
case "param-type":
if (stream.peek() == "}") {
state.soyState.pop();
return null;
}
if (stream.eatWhile(/^[\w]+/)) {
return "variable-3";
if (stream.eatWhile(/^([\w]+|[?])/)) {
return "type";
}
stream.next();
return null;
@ -241,11 +259,22 @@
});
}
return "attribute";
} else if (match = stream.match(/([\w]+)(?=\()/)) {
return "variable callee";
} else if (match = stream.match(/^["']/)) {
state.soyState.push("string");
state.quoteKind = match;
return "string";
}
if (stream.match(/(true|false)(?!\w)/) ||
stream.match(/0x([0-9a-fA-F]{2,})/) ||
stream.match(/-?([0-9]*[.])?[0-9]+/)) {
return "atom";
}
if (stream.match(/(\||[+\-*\/%]|[=!][=]|[<>][=]?)/)) {
// Tokenize filter, binary, and equality operators.
return "operator";
}
if (match = stream.match(/^\$([\w]+)/)) {
return ref(state.variables, match[1]);
}
@ -270,7 +299,7 @@
return "keyword";
// A tag-keyword must be followed by whitespace, comment or a closing tag.
} else if (match = stream.match(/^\{([\/@\\]?\w+\??)(?=[\s\}]|\/[/*])/)) {
} else if (match = stream.match(/^\{([/@\\]?\w+\??)(?=$|[\s}]|\/[/*])/)) {
if (match[1] != "/switch")
state.indent += (/^(\/|(else|elseif|ifempty|case|fallbackmsg|default)$)/.test(match[1]) && state.tag != "switch" ? 1 : 2) * config.indentUnit;
state.tag = match[1];
@ -295,11 +324,14 @@
state.scopes = prepend(state.scopes, state.variables);
state.soyState.push("var-def");
} else if (state.tag == "namespace") {
state.soyState.push("namespace-def");
if (!state.scopes) {
state.variables = prepend(null, 'ij');
}
} else if (state.tag.match(/^@(?:param\??|inject)/)) {
} else if (state.tag.match(/^@(?:param\??|inject|prop)/)) {
state.soyState.push("param-def");
} else if (state.tag.match(/^(?:param)/)) {
state.soyState.push("param-ref");
}
return "keyword";
@ -348,6 +380,8 @@
};
}, "htmlmixed");
CodeMirror.registerHelper("wordChars", "soy", /[\w$]/);
CodeMirror.registerHelper("hintWords", "soy", indentingTags.concat(
["delpackage", "namespace", "alias", "print", "css", "debugger"]));