##// END OF EJS Templates
Translation updates from RhodeCode v2.2.5...
Translation updates from RhodeCode v2.2.5 Includes a new German translation. These are licensed under GPLv3, for various reasons, including since they include textual copies of strings from the GPLv3'd Python and HTML files.

File last commit:

r4026:a60a0e90 default
r4137:6c485794 rhodecode-2.2.5-gpl
Show More
jinja2.js
42 lines | 1.3 KiB | application/javascript | JavascriptLexer
added codemirror edit mode with autodetection
r4026 CodeMirror.defineMode("jinja2", function() {
var keywords = ["block", "endblock", "for", "endfor", "in", "true", "false",
"loop", "none", "self", "super", "if", "as", "not", "and",
"else", "import", "with", "without", "context"];
keywords = new RegExp("^((" + keywords.join(")|(") + "))\\b");
function tokenBase (stream, state) {
var ch = stream.next();
if (ch == "{") {
if (ch = stream.eat(/\{|%|#/)) {
stream.eat("-");
state.tokenize = inTag(ch);
return "tag";
}
}
}
function inTag (close) {
if (close == "{") {
close = "}";
}
return function (stream, state) {
var ch = stream.next();
if ((ch == close || (ch == "-" && stream.eat(close)))
&& stream.eat("}")) {
state.tokenize = tokenBase;
return "tag";
}
if (stream.match(keywords)) {
return "keyword";
}
return close == "#" ? "comment" : "string";
};
}
return {
startState: function () {
return {tokenize: tokenBase};
},
token: function (stream, state) {
return state.tokenize(stream, state);
}
};
});