Files
@ 9dd726706178
Branch filter:
Location: kallithea/rhodecode/public/js/mode/smartymixed/smartymixed.js - annotation
9dd726706178
5.2 KiB
text/javascript
Complete copyright notices for web interface; change footer to link to them.
The original copyright notice found in the footer was not accurate as it
included only one of the many copyright holders in this project. This change
creates an "about" page, which currently contains just the copyright and
license information. It links to repository for additional potential copyright
holders not listed on the about page.
Unlisted contributors are mentioned in template comments.
Html links for Kallithea is fixed and we link to Conservancy.
Display of version information in the footer is improved.
The original copyright notice found in the footer was not accurate as it
included only one of the many copyright holders in this project. This change
creates an "about" page, which currently contains just the copyright and
license information. It links to repository for additional potential copyright
holders not listed on the about page.
Unlisted contributors are mentioned in template comments.
Html links for Kallithea is fixed and we link to Conservancy.
Display of version information in the footer is improved.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 bb9ef0638069 | /**
* @file smartymixed.js
* @brief Smarty Mixed Codemirror mode (Smarty + Mixed HTML)
* @author Ruslan Osmanov <rrosmanov at gmail dot com>
* @version 3.0
* @date 05.07.2013
*/
CodeMirror.defineMode("smartymixed", function(config) {
var settings, regs, helpers, parsers,
htmlMixedMode = CodeMirror.getMode(config, "htmlmixed"),
smartyMode = CodeMirror.getMode(config, "smarty"),
settings = {
rightDelimiter: '}',
leftDelimiter: '{'
};
if (config.hasOwnProperty("leftDelimiter")) {
settings.leftDelimiter = config.leftDelimiter;
}
if (config.hasOwnProperty("rightDelimiter")) {
settings.rightDelimiter = config.rightDelimiter;
}
regs = {
smartyComment: new RegExp("^" + settings.leftDelimiter + "\\*"),
literalOpen: new RegExp(settings.leftDelimiter + "literal" + settings.rightDelimiter),
literalClose: new RegExp(settings.leftDelimiter + "\/literal" + settings.rightDelimiter),
hasLeftDelimeter: new RegExp(".*" + settings.leftDelimiter),
htmlHasLeftDelimeter: new RegExp("[^<>]*" + settings.leftDelimiter)
};
helpers = {
chain: function(stream, state, parser) {
state.tokenize = parser;
return parser(stream, state);
},
cleanChain: function(stream, state, parser) {
state.tokenize = null;
state.localState = null;
state.localMode = null;
return (typeof parser == "string") ? (parser ? parser : null) : parser(stream, state);
},
maybeBackup: function(stream, pat, style) {
var cur = stream.current();
var close = cur.search(pat),
m;
if (close > - 1) stream.backUp(cur.length - close);
else if (m = cur.match(/<\/?$/)) {
stream.backUp(cur.length);
if (!stream.match(pat, false)) stream.match(cur[0]);
}
return style;
}
};
parsers = {
html: function(stream, state) {
if (!state.inLiteral && stream.match(regs.htmlHasLeftDelimeter, false)) {
state.tokenize = parsers.smarty;
state.localMode = smartyMode;
state.localState = smartyMode.startState(htmlMixedMode.indent(state.htmlMixedState, ""));
return helpers.maybeBackup(stream, settings.leftDelimiter, smartyMode.token(stream, state.localState));
}
return htmlMixedMode.token(stream, state.htmlMixedState);
},
smarty: function(stream, state) {
if (stream.match(settings.leftDelimiter, false)) {
if (stream.match(regs.smartyComment, false)) {
return helpers.chain(stream, state, parsers.inBlock("comment", "*" + settings.rightDelimiter));
}
} else if (stream.match(settings.rightDelimiter, false)) {
stream.eat(settings.rightDelimiter);
state.tokenize = parsers.html;
state.localMode = htmlMixedMode;
state.localState = state.htmlMixedState;
return "tag";
}
return helpers.maybeBackup(stream, settings.rightDelimiter, smartyMode.token(stream, state.localState));
},
inBlock: function(style, terminator) {
return function(stream, state) {
while (!stream.eol()) {
if (stream.match(terminator)) {
helpers.cleanChain(stream, state, "");
break;
}
stream.next();
}
return style;
};
}
};
return {
startState: function() {
var state = htmlMixedMode.startState();
return {
token: parsers.html,
localMode: null,
localState: null,
htmlMixedState: state,
tokenize: null,
inLiteral: false
};
},
copyState: function(state) {
var local = null, tok = (state.tokenize || state.token);
if (state.localState) {
local = CodeMirror.copyState((tok != parsers.html ? smartyMode : htmlMixedMode), state.localState);
}
return {
token: state.token,
tokenize: state.tokenize,
localMode: state.localMode,
localState: local,
htmlMixedState: CodeMirror.copyState(htmlMixedMode, state.htmlMixedState),
inLiteral: state.inLiteral
};
},
token: function(stream, state) {
if (stream.match(settings.leftDelimiter, false)) {
if (!state.inLiteral && stream.match(regs.literalOpen, true)) {
state.inLiteral = true;
return "keyword";
} else if (state.inLiteral && stream.match(regs.literalClose, true)) {
state.inLiteral = false;
return "keyword";
}
}
if (state.inLiteral && state.localState != state.htmlMixedState) {
state.tokenize = parsers.html;
state.localMode = htmlMixedMode;
state.localState = state.htmlMixedState;
}
var style = (state.tokenize || state.token)(stream, state);
return style;
},
indent: function(state, textAfter) {
if (state.localMode == smartyMode
|| (state.inLiteral && !state.localMode)
|| regs.hasLeftDelimeter.test(textAfter)) {
return CodeMirror.Pass;
}
return htmlMixedMode.indent(state.htmlMixedState, textAfter);
},
electricChars: "/{}:",
innerMode: function(state) {
return {
state: state.localState || state.htmlMixedState,
mode: state.localMode || htmlMixedMode
};
}
};
},
"htmlmixed");
CodeMirror.defineMIME("text/x-smarty", "smartymixed");
// vim: et ts=2 sts=2 sw=2
|