mirror of
https://github.com/documize/community.git
synced 2025-08-02 03:55:24 +02:00
Update CodeMirror dep to v5.42.2
Affects Code and Markdown section types
This commit is contained in:
parent
c706edec47
commit
479a61a3ef
347 changed files with 21845 additions and 20770 deletions
4
gui/public/codemirror/mode/soy/index.html
vendored
4
gui/public/codemirror/mode/soy/index.html
vendored
|
@ -12,9 +12,9 @@
|
|||
<script src="../javascript/javascript.js"></script>
|
||||
<script src="../css/css.js"></script>
|
||||
<script src="soy.js"></script>
|
||||
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
||||
<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
||||
<div id=nav>
|
||||
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
|
||||
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
|
||||
|
||||
<ul>
|
||||
<li><a href="../../index.html">Home</a>
|
||||
|
|
60
gui/public/codemirror/mode/soy/soy.js
vendored
60
gui/public/codemirror/mode/soy/soy.js
vendored
|
@ -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"]));
|
||||
|
||||
|
|
83
gui/public/codemirror/mode/soy/test.js
vendored
83
gui/public/codemirror/mode/soy/test.js
vendored
|
@ -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() {
|
||||
var mode = CodeMirror.getMode({indentUnit: 2}, "soy");
|
||||
|
@ -8,7 +8,7 @@
|
|||
// Test of small keywords and words containing them.
|
||||
MT('keywords-test',
|
||||
'[keyword {] [keyword as] worrying [keyword and] notorious [keyword as]',
|
||||
' the Fandor-alias assassin, [keyword or]',
|
||||
' the Fandor[operator -]alias assassin, [keyword or]',
|
||||
' Corcand cannot fit [keyword in] [keyword }]');
|
||||
|
||||
MT('let-test',
|
||||
|
@ -20,18 +20,60 @@
|
|||
'[keyword {/template}]',
|
||||
'');
|
||||
|
||||
MT('function-test',
|
||||
'[keyword {] [callee&variable css]([string "MyClass"])[keyword }]',
|
||||
'[tag&bracket <][tag input] [attribute value]=[string "]' +
|
||||
'[keyword {] [callee&variable index]([variable-2&error $list])[keyword }]' +
|
||||
'[string "][tag&bracket />]');
|
||||
|
||||
MT('namespace-test',
|
||||
'[keyword {namespace] [variable namespace][keyword }]')
|
||||
|
||||
MT('namespace-with-attribute-test',
|
||||
'[keyword {namespace] [variable my.namespace.templates] ' +
|
||||
'[attribute requirecss]=[string "my.namespace"][keyword }]');
|
||||
|
||||
MT('operators-test',
|
||||
'[keyword {] [atom 1] [operator ==] [atom 1] [keyword }]',
|
||||
'[keyword {] [atom 1] [operator !=] [atom 2] [keyword }]',
|
||||
'[keyword {] [atom 2] [operator +] [atom 2] [keyword }]',
|
||||
'[keyword {] [atom 2] [operator -] [atom 2] [keyword }]',
|
||||
'[keyword {] [atom 2] [operator *] [atom 2] [keyword }]',
|
||||
'[keyword {] [atom 2] [operator /] [atom 2] [keyword }]',
|
||||
'[keyword {] [atom 2] [operator %] [atom 2] [keyword }]',
|
||||
'[keyword {] [atom 2] [operator <=] [atom 2] [keyword }]',
|
||||
'[keyword {] [atom 2] [operator >=] [atom 2] [keyword }]',
|
||||
'[keyword {] [atom 3] [operator >] [atom 2] [keyword }]',
|
||||
'[keyword {] [atom 2] [operator >] [atom 3] [keyword }]',
|
||||
'[keyword {] [variable-2&error $variable] [operator |] safeHtml [keyword }]')
|
||||
|
||||
MT('primitive-test',
|
||||
'[keyword {] [atom true] [keyword }]',
|
||||
'[keyword {] [atom false] [keyword }]',
|
||||
'[keyword {] truethy [keyword }]',
|
||||
'[keyword {] falsey [keyword }]',
|
||||
'[keyword {] [atom 42] [keyword }]',
|
||||
'[keyword {] [atom .42] [keyword }]',
|
||||
'[keyword {] [atom 0.42] [keyword }]',
|
||||
'[keyword {] [atom -0.42] [keyword }]',
|
||||
'[keyword {] [atom -.2] [keyword }]',
|
||||
'[keyword {] [atom 0x1F] [keyword }]',
|
||||
'[keyword {] [atom 0x1F00BBEA] [keyword }]');
|
||||
|
||||
MT('param-type-test',
|
||||
'[keyword {@param] [def a]: ' +
|
||||
'[variable-3 list]<[[[variable-3 a]: [variable-3 int], ' +
|
||||
'[variable-3 b]: [variable-3 map]<[variable-3 string], ' +
|
||||
'[variable-3 bool]>]]>][keyword }]');
|
||||
'[type list]<[[[type a]: [type int], ' +
|
||||
'[type b]: [type map]<[type string], ' +
|
||||
'[type bool]>]]>][keyword }]',
|
||||
'[keyword {@param] [def unknown]: [type ?][keyword }]',
|
||||
'[keyword {@param] [def list]: [type list]<[type ?]>[keyword }]');
|
||||
|
||||
MT('undefined-var',
|
||||
'[keyword {][variable-2&error $var]');
|
||||
|
||||
MT('param-scope-test',
|
||||
'[keyword {template] [def .a][keyword }]',
|
||||
' [keyword {@param] [def x]: [variable-3 string][keyword }]',
|
||||
' [keyword {@param] [def x]: [type string][keyword }]',
|
||||
' [keyword {][variable-2 $x][keyword }]',
|
||||
'[keyword {/template}]',
|
||||
'',
|
||||
|
@ -48,7 +90,7 @@
|
|||
|
||||
MT('defined-if-variable-test',
|
||||
'[keyword {template] [def .foo][keyword }]',
|
||||
' [keyword {@param?] [def showThing]: [variable-3 bool][keyword }]',
|
||||
' [keyword {@param?] [def showThing]: [type bool][keyword }]',
|
||||
' [keyword {if] [variable-2 $showThing][keyword }]',
|
||||
' Yo!',
|
||||
' [keyword {/if}]',
|
||||
|
@ -56,17 +98,15 @@
|
|||
'');
|
||||
|
||||
MT('template-calls-test',
|
||||
'[keyword {template] [def .foo][keyword }]',
|
||||
' Yo!',
|
||||
'[keyword {/template}]',
|
||||
'[keyword {call] [variable-2 .foo][keyword /}]',
|
||||
'[keyword {call] [variable foo][keyword /}]',
|
||||
'[keyword {call] [variable .bar][keyword /}]',
|
||||
'[keyword {call] [variable bar][keyword /}]',
|
||||
'[keyword {call] [variable foo][keyword }] [keyword {/call}]',
|
||||
'[keyword {call] [variable first1.second.third_3][keyword /}]',
|
||||
'[keyword {call] [variable first1.second.third_3] [keyword }] [keyword {/call}]',
|
||||
'');
|
||||
|
||||
MT('foreach-scope-test',
|
||||
'[keyword {@param] [def bar]: [variable-3 string][keyword }]',
|
||||
'[keyword {@param] [def bar]: [type string][keyword }]',
|
||||
'[keyword {foreach] [def $foo] [keyword in] [variable-2&error $foos][keyword }]',
|
||||
' [keyword {][variable-2 $foo][keyword }]',
|
||||
'[keyword {/foreach}]',
|
||||
|
@ -84,8 +124,8 @@
|
|||
MT('nested-kind-test',
|
||||
'[keyword {template] [def .foo] [attribute kind]=[string "html"][keyword }]',
|
||||
' [tag&bracket <][tag div][tag&bracket >]',
|
||||
' [keyword {call] [variable .bar][keyword }]',
|
||||
' [keyword {param] [attribute kind]=[string "js"][keyword }]',
|
||||
' [keyword {call] [variable-2 .bar][keyword }]',
|
||||
' [keyword {param] [property propertyName] [attribute kind]=[string "js"][keyword }]',
|
||||
' [keyword var] [def bar] [operator =] [number 5];',
|
||||
' [keyword {/param}]',
|
||||
' [keyword {/call}]',
|
||||
|
@ -94,14 +134,14 @@
|
|||
'');
|
||||
|
||||
MT('tag-starting-with-function-call-is-not-a-keyword',
|
||||
'[keyword {]index([variable-2&error $foo])[keyword }]',
|
||||
'[keyword {][callee&variable index]([variable-2&error $foo])[keyword }]',
|
||||
'[keyword {css] [string "some-class"][keyword }]',
|
||||
'[keyword {]css([string "some-class"])[keyword }]',
|
||||
'[keyword {][callee&variable css]([string "some-class"])[keyword }]',
|
||||
'');
|
||||
|
||||
MT('allow-missing-colon-in-@param',
|
||||
'[keyword {template] [def .foo][keyword }]',
|
||||
' [keyword {@param] [def showThing] [variable-3 bool][keyword }]',
|
||||
' [keyword {@param] [def showThing] [type bool][keyword }]',
|
||||
' [keyword {if] [variable-2 $showThing][keyword }]',
|
||||
' Yo!',
|
||||
' [keyword {/if}]',
|
||||
|
@ -111,4 +151,11 @@
|
|||
MT('single-quote-strings',
|
||||
'[keyword {][string "foo"] [string \'bar\'][keyword }]',
|
||||
'');
|
||||
|
||||
MT('literal-comments',
|
||||
'[keyword {literal}]/* comment */ // comment[keyword {/literal}]');
|
||||
|
||||
MT('highlight-command-at-eol',
|
||||
'[keyword {msg]',
|
||||
' [keyword }]');
|
||||
})();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue