liquid_cms 0.3.0.1 → 0.3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +5 -1
- data/Gemfile.lock +1 -1
- data/README.rdoc +5 -1
- data/app/helpers/cms/common_helper.rb +1 -0
- data/app/views/cms/pages/_page.html.erb +2 -1
- data/app/views/layouts/cms.html.erb +2 -1
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/LICENSE +2 -2
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/css/csscolors.css +12 -8
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/css/docs.css +123 -29
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/csstest.html +1 -1
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/htmltest.html +1 -1
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/index.html +232 -179
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/js/codemirror.js +211 -65
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/js/editor.js +360 -194
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/js/mirrorframe.js +1 -1
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/js/parsecss.js +11 -7
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/js/parsejavascript.js +14 -5
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/js/parsesparql.js +1 -1
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/js/select.js +140 -87
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/js/stringstream.js +5 -0
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/js/tokenizejavascript.js +1 -1
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/js/undo.js +7 -7
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/manual.html +148 -52
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/story.html +631 -614
- data/lib/generators/liquid_cms/templates/public/cms/stylesheets/styles.css +7 -7
- data/lib/liquid_cms/version.rb +1 -1
- metadata +4 -26
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/lua/LICENSE +0 -32
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/lua/css/luacolors.css +0 -63
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/lua/index.html +0 -68
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/lua/js/parselua.js +0 -253
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/php/LICENSE +0 -37
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/php/css/phpcolors.css +0 -114
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/php/index.html +0 -292
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/php/js/parsephp.js +0 -371
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/php/js/parsephphtmlmixed.js +0 -90
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/php/js/tokenizephp.js +0 -1006
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/plsql/LICENSE +0 -22
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/plsql/css/plsqlcolors.css +0 -57
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/plsql/index.html +0 -67
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/plsql/js/parseplsql.js +0 -233
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/python/LICENSE +0 -32
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/python/css/pythoncolors.css +0 -58
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/python/index.html +0 -141
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/python/js/parsepython.js +0 -542
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/sql/LICENSE +0 -22
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/sql/css/sqlcolors.css +0 -57
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/sql/index.html +0 -56
- data/lib/generators/liquid_cms/templates/public/cms/codemirror/contrib/sql/js/parsesql.js +0 -211
@@ -1,211 +0,0 @@
|
|
1
|
-
var SqlParser = Editor.Parser = (function() {
|
2
|
-
|
3
|
-
function wordRegexp(words) {
|
4
|
-
return new RegExp("^(?:" + words.join("|") + ")$", "i");
|
5
|
-
}
|
6
|
-
|
7
|
-
var functions = wordRegexp([
|
8
|
-
"abs", "acos", "adddate", "aes_encrypt", "aes_decrypt", "ascii",
|
9
|
-
"asin", "atan", "atan2", "avg", "benchmark", "bin", "bit_and",
|
10
|
-
"bit_count", "bit_length", "bit_or", "cast", "ceil", "ceiling",
|
11
|
-
"char_length", "character_length", "coalesce", "concat", "concat_ws",
|
12
|
-
"connection_id", "conv", "convert", "cos", "cot", "count", "curdate",
|
13
|
-
"current_date", "current_time", "current_timestamp", "current_user",
|
14
|
-
"curtime", "database", "date_add", "date_format", "date_sub",
|
15
|
-
"dayname", "dayofmonth", "dayofweek", "dayofyear", "decode", "degrees",
|
16
|
-
"des_encrypt", "des_decrypt", "elt", "encode", "encrypt", "exp",
|
17
|
-
"export_set", "extract", "field", "find_in_set", "floor", "format",
|
18
|
-
"found_rows", "from_days", "from_unixtime", "get_lock", "greatest",
|
19
|
-
"group_unique_users", "hex", "ifnull", "inet_aton", "inet_ntoa", "instr",
|
20
|
-
"interval", "is_free_lock", "isnull", "last_insert_id", "lcase", "least",
|
21
|
-
"left", "length", "ln", "load_file", "locate", "log", "log2", "log10",
|
22
|
-
"lower", "lpad", "ltrim", "make_set", "master_pos_wait", "max", "md5",
|
23
|
-
"mid", "min", "mod", "monthname", "now", "nullif", "oct", "octet_length",
|
24
|
-
"ord", "password", "period_add", "period_diff", "pi", "position",
|
25
|
-
"pow", "power", "quarter", "quote", "radians", "rand", "release_lock",
|
26
|
-
"repeat", "reverse", "right", "round", "rpad", "rtrim", "sec_to_time",
|
27
|
-
"session_user", "sha", "sha1", "sign", "sin", "soundex", "space", "sqrt",
|
28
|
-
"std", "stddev", "strcmp", "subdate", "substring", "substring_index",
|
29
|
-
"sum", "sysdate", "system_user", "tan", "time_format", "time_to_sec",
|
30
|
-
"to_days", "trim", "ucase", "unique_users", "unix_timestamp", "upper",
|
31
|
-
"user", "version", "week", "weekday", "yearweek"
|
32
|
-
]);
|
33
|
-
|
34
|
-
var keywords = wordRegexp([
|
35
|
-
"alter", "grant", "revoke", "primary", "key", "table", "start",
|
36
|
-
"transaction", "select", "update", "insert", "delete", "create", "describe",
|
37
|
-
"from", "into", "values", "where", "join", "inner", "left", "natural", "and",
|
38
|
-
"or", "in", "not", "xor", "like", "using", "on", "order", "group", "by",
|
39
|
-
"asc", "desc", "limit", "offset", "union", "all", "as", "distinct", "set",
|
40
|
-
"commit", "rollback", "replace", "view", "database", "separator", "if",
|
41
|
-
"exists", "null", "truncate", "status", "show", "lock", "unique"
|
42
|
-
]);
|
43
|
-
|
44
|
-
var types = wordRegexp([
|
45
|
-
"bigint", "binary", "bit", "blob", "bool", "char", "character", "date",
|
46
|
-
"datetime", "dec", "decimal", "double", "enum", "float", "float4", "float8",
|
47
|
-
"int", "int1", "int2", "int3", "int4", "int8", "integer", "long", "longblob",
|
48
|
-
"longtext", "mediumblob", "mediumint", "mediumtext", "middleint", "nchar",
|
49
|
-
"numeric", "real", "set", "smallint", "text", "time", "timestamp", "tinyblob",
|
50
|
-
"tinyint", "tinytext", "varbinary", "varchar", "year"
|
51
|
-
]);
|
52
|
-
|
53
|
-
var operators = wordRegexp([
|
54
|
-
":=", "<", "<=", "==", "<>", ">", ">=", "like", "rlike", "in", "xor", "between"
|
55
|
-
]);
|
56
|
-
|
57
|
-
var operatorChars = /[*+\-<>=&|:\/]/;
|
58
|
-
|
59
|
-
var tokenizeSql = (function() {
|
60
|
-
function normal(source, setState) {
|
61
|
-
var ch = source.next();
|
62
|
-
if (ch == "@" || ch == "$") {
|
63
|
-
source.nextWhileMatches(/[\w\d]/);
|
64
|
-
return "sql-var";
|
65
|
-
}
|
66
|
-
else if (ch == "\"" || ch == "'" || ch == "`") {
|
67
|
-
setState(inLiteral(ch));
|
68
|
-
return null;
|
69
|
-
}
|
70
|
-
else if (ch == "," || ch == ";") {
|
71
|
-
return "sql-separator"
|
72
|
-
}
|
73
|
-
else if (ch == '-') {
|
74
|
-
if (source.peek() == "-") {
|
75
|
-
while (!source.endOfLine()) source.next();
|
76
|
-
return "sql-comment";
|
77
|
-
}
|
78
|
-
else if (/\d/.test(source.peek())) {
|
79
|
-
source.nextWhileMatches(/\d/);
|
80
|
-
if (source.peek() == '.') {
|
81
|
-
source.next();
|
82
|
-
source.nextWhileMatches(/\d/);
|
83
|
-
}
|
84
|
-
return "sql-number";
|
85
|
-
}
|
86
|
-
else
|
87
|
-
return "sql-operator";
|
88
|
-
}
|
89
|
-
else if (operatorChars.test(ch)) {
|
90
|
-
source.nextWhileMatches(operatorChars);
|
91
|
-
return "sql-operator";
|
92
|
-
}
|
93
|
-
else if (/\d/.test(ch)) {
|
94
|
-
source.nextWhileMatches(/\d/);
|
95
|
-
if (source.peek() == '.') {
|
96
|
-
source.next();
|
97
|
-
source.nextWhileMatches(/\d/);
|
98
|
-
}
|
99
|
-
return "sql-number";
|
100
|
-
}
|
101
|
-
else if (/[()]/.test(ch)) {
|
102
|
-
return "sql-punctuation";
|
103
|
-
}
|
104
|
-
else {
|
105
|
-
source.nextWhileMatches(/[_\w\d]/);
|
106
|
-
var word = source.get(), type;
|
107
|
-
if (operators.test(word))
|
108
|
-
type = "sql-operator";
|
109
|
-
else if (keywords.test(word))
|
110
|
-
type = "sql-keyword";
|
111
|
-
else if (functions.test(word))
|
112
|
-
type = "sql-function";
|
113
|
-
else if (types.test(word))
|
114
|
-
type = "sql-type";
|
115
|
-
else
|
116
|
-
type = "sql-word";
|
117
|
-
return {style: type, content: word};
|
118
|
-
}
|
119
|
-
}
|
120
|
-
|
121
|
-
function inLiteral(quote) {
|
122
|
-
return function(source, setState) {
|
123
|
-
var escaped = false;
|
124
|
-
while (!source.endOfLine()) {
|
125
|
-
var ch = source.next();
|
126
|
-
if (ch == quote && !escaped) {
|
127
|
-
setState(normal);
|
128
|
-
break;
|
129
|
-
}
|
130
|
-
escaped = !escaped && ch == "\\";
|
131
|
-
}
|
132
|
-
return quote == "`" ? "sql-word" : "sql-literal";
|
133
|
-
};
|
134
|
-
}
|
135
|
-
|
136
|
-
return function(source, startState) {
|
137
|
-
return tokenizer(source, startState || normal);
|
138
|
-
};
|
139
|
-
})();
|
140
|
-
|
141
|
-
function indentSql(context) {
|
142
|
-
return function(nextChars) {
|
143
|
-
var firstChar = nextChars && nextChars.charAt(0);
|
144
|
-
var closing = context && firstChar == context.type;
|
145
|
-
if (!context)
|
146
|
-
return 0;
|
147
|
-
else if (context.align)
|
148
|
-
return context.col - (closing ? context.width : 0);
|
149
|
-
else
|
150
|
-
return context.indent + (closing ? 0 : indentUnit);
|
151
|
-
}
|
152
|
-
}
|
153
|
-
|
154
|
-
function parseSql(source) {
|
155
|
-
var tokens = tokenizeSql(source);
|
156
|
-
var context = null, indent = 0, col = 0;
|
157
|
-
function pushContext(type, width, align) {
|
158
|
-
context = {prev: context, indent: indent, col: col, type: type, width: width, align: align};
|
159
|
-
}
|
160
|
-
function popContext() {
|
161
|
-
context = context.prev;
|
162
|
-
}
|
163
|
-
|
164
|
-
var iter = {
|
165
|
-
next: function() {
|
166
|
-
var token = tokens.next();
|
167
|
-
var type = token.style, content = token.content, width = token.value.length;
|
168
|
-
|
169
|
-
if (content == "\n") {
|
170
|
-
token.indentation = indentSql(context);
|
171
|
-
indent = col = 0;
|
172
|
-
if (context && context.align == null) context.align = false;
|
173
|
-
}
|
174
|
-
else if (type == "whitespace" && col == 0) {
|
175
|
-
indent = width;
|
176
|
-
}
|
177
|
-
else if (!context && type != "sql-comment") {
|
178
|
-
pushContext(";", 0, false);
|
179
|
-
}
|
180
|
-
|
181
|
-
if (content != "\n") col += width;
|
182
|
-
|
183
|
-
if (type == "sql-punctuation") {
|
184
|
-
if (content == "(")
|
185
|
-
pushContext(")", width);
|
186
|
-
else if (content == ")")
|
187
|
-
popContext();
|
188
|
-
}
|
189
|
-
else if (type == "sql-separator" && content == ";" && context && !context.prev) {
|
190
|
-
popContext();
|
191
|
-
}
|
192
|
-
|
193
|
-
return token;
|
194
|
-
},
|
195
|
-
|
196
|
-
copy: function() {
|
197
|
-
var _context = context, _indent = indent, _col = col, _tokenState = tokens.state;
|
198
|
-
return function(source) {
|
199
|
-
tokens = tokenizeSql(source, _tokenState);
|
200
|
-
context = _context;
|
201
|
-
indent = _indent;
|
202
|
-
col = _col;
|
203
|
-
return iter;
|
204
|
-
};
|
205
|
-
}
|
206
|
-
};
|
207
|
-
return iter;
|
208
|
-
}
|
209
|
-
|
210
|
-
return {make: parseSql, electricChars: ")"};
|
211
|
-
})();
|