codemirror-rails 4.7 → 4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/codemirror/rails/version.rb +2 -2
- data/vendor/assets/javascripts/codemirror.js +229 -137
- data/vendor/assets/javascripts/codemirror/addons/edit/closebrackets.js +1 -1
- data/vendor/assets/javascripts/codemirror/addons/hint/javascript-hint.js +9 -9
- data/vendor/assets/javascripts/codemirror/addons/hint/xml-hint.js +9 -1
- data/vendor/assets/javascripts/codemirror/addons/mode/loadmode.js +19 -16
- data/vendor/assets/javascripts/codemirror/addons/mode/overlay.js +3 -3
- data/vendor/assets/javascripts/codemirror/keymaps/emacs.js +19 -28
- data/vendor/assets/javascripts/codemirror/keymaps/sublime.js +14 -15
- data/vendor/assets/javascripts/codemirror/keymaps/vim.js +694 -752
- data/vendor/assets/javascripts/codemirror/modes/clike.js +15 -0
- data/vendor/assets/javascripts/codemirror/modes/css.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/dockerfile.js +80 -0
- data/vendor/assets/javascripts/codemirror/modes/gfm.js +2 -1
- data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +2 -2
- data/vendor/assets/javascripts/codemirror/modes/idl.js +290 -0
- data/vendor/assets/javascripts/codemirror/modes/markdown.js +62 -55
- data/vendor/assets/javascripts/codemirror/modes/sparql.js +19 -5
- data/vendor/assets/javascripts/codemirror/modes/sql.js +0 -2
- data/vendor/assets/javascripts/codemirror/modes/stex.js +184 -193
- data/vendor/assets/javascripts/codemirror/modes/yaml.js +6 -1
- data/vendor/assets/stylesheets/codemirror.css +11 -2
- data/vendor/assets/stylesheets/codemirror/themes/3024-day.css +1 -1
- data/vendor/assets/stylesheets/codemirror/themes/solarized.css +0 -5
- metadata +3 -1
@@ -19,18 +19,28 @@ CodeMirror.defineMode("sparql", function(config) {
|
|
19
19
|
return new RegExp("^(?:" + words.join("|") + ")$", "i");
|
20
20
|
}
|
21
21
|
var ops = wordRegexp(["str", "lang", "langmatches", "datatype", "bound", "sameterm", "isiri", "isuri",
|
22
|
+
"iri", "uri", "bnode", "count", "sum", "min", "max", "avg", "sample",
|
23
|
+
"group_concat", "rand", "abs", "ceil", "floor", "round", "concat", "substr", "strlen",
|
24
|
+
"replace", "ucase", "lcase", "encode_for_uri", "contains", "strstarts", "strends",
|
25
|
+
"strbefore", "strafter", "year", "month", "day", "hours", "minutes", "seconds",
|
26
|
+
"timezone", "tz", "now", "uuid", "struuid", "md5", "sha1", "sha256", "sha384",
|
27
|
+
"sha512", "coalesce", "if", "strlang", "strdt", "isnumeric", "regex", "exists",
|
22
28
|
"isblank", "isliteral", "a"]);
|
23
29
|
var keywords = wordRegexp(["base", "prefix", "select", "distinct", "reduced", "construct", "describe",
|
24
30
|
"ask", "from", "named", "where", "order", "limit", "offset", "filter", "optional",
|
25
31
|
"graph", "by", "asc", "desc", "as", "having", "undef", "values", "group",
|
26
32
|
"minus", "in", "not", "service", "silent", "using", "insert", "delete", "union",
|
33
|
+
"true", "false", "with",
|
27
34
|
"data", "copy", "to", "move", "add", "create", "drop", "clear", "load"]);
|
28
|
-
var operatorChars = /[
|
35
|
+
var operatorChars = /[*+\-<>=&|\^\/!\?]/;
|
29
36
|
|
30
37
|
function tokenBase(stream, state) {
|
31
38
|
var ch = stream.next();
|
32
39
|
curPunc = null;
|
33
40
|
if (ch == "$" || ch == "?") {
|
41
|
+
if(ch == "?" && stream.match(/\s/, false)){
|
42
|
+
return "operator";
|
43
|
+
}
|
34
44
|
stream.match(/^[\w\d]*/);
|
35
45
|
return "variable-2";
|
36
46
|
}
|
@@ -44,7 +54,7 @@ CodeMirror.defineMode("sparql", function(config) {
|
|
44
54
|
}
|
45
55
|
else if (/[{}\(\),\.;\[\]]/.test(ch)) {
|
46
56
|
curPunc = ch;
|
47
|
-
return
|
57
|
+
return "bracket";
|
48
58
|
}
|
49
59
|
else if (ch == "#") {
|
50
60
|
stream.skipToEnd();
|
@@ -52,12 +62,16 @@ CodeMirror.defineMode("sparql", function(config) {
|
|
52
62
|
}
|
53
63
|
else if (operatorChars.test(ch)) {
|
54
64
|
stream.eatWhile(operatorChars);
|
55
|
-
return
|
65
|
+
return "operator";
|
56
66
|
}
|
57
67
|
else if (ch == ":") {
|
58
68
|
stream.eatWhile(/[\w\d\._\-]/);
|
59
69
|
return "atom";
|
60
70
|
}
|
71
|
+
else if (ch == "@") {
|
72
|
+
stream.eatWhile(/[a-z\d\-]/i);
|
73
|
+
return "meta";
|
74
|
+
}
|
61
75
|
else {
|
62
76
|
stream.eatWhile(/[_\w\d]/);
|
63
77
|
if (stream.eat(":")) {
|
@@ -66,7 +80,7 @@ CodeMirror.defineMode("sparql", function(config) {
|
|
66
80
|
}
|
67
81
|
var word = stream.current();
|
68
82
|
if (ops.test(word))
|
69
|
-
return
|
83
|
+
return "builtin";
|
70
84
|
else if (keywords.test(word))
|
71
85
|
return "keyword";
|
72
86
|
else
|
@@ -155,6 +169,6 @@ CodeMirror.defineMode("sparql", function(config) {
|
|
155
169
|
};
|
156
170
|
});
|
157
171
|
|
158
|
-
CodeMirror.defineMIME("application/
|
172
|
+
CodeMirror.defineMIME("application/sparql-query", "sparql");
|
159
173
|
|
160
174
|
});
|
@@ -367,8 +367,6 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
|
|
367
367
|
|
368
368
|
keywords:
|
369
369
|
A list of keywords you want to be highlighted.
|
370
|
-
functions:
|
371
|
-
A list of function names you want to be highlighted.
|
372
370
|
builtin:
|
373
371
|
A list of builtin types you want to be highlighted (if you want types to be of class "builtin" instead of "keyword").
|
374
372
|
operatorChars:
|
@@ -14,60 +14,60 @@
|
|
14
14
|
else // Plain browser env
|
15
15
|
mod(CodeMirror);
|
16
16
|
})(function(CodeMirror) {
|
17
|
-
"use strict";
|
17
|
+
"use strict";
|
18
18
|
|
19
|
-
CodeMirror.defineMode("stex", function() {
|
19
|
+
CodeMirror.defineMode("stex", function() {
|
20
20
|
"use strict";
|
21
21
|
|
22
22
|
function pushCommand(state, command) {
|
23
|
-
|
23
|
+
state.cmdState.push(command);
|
24
24
|
}
|
25
25
|
|
26
26
|
function peekCommand(state) {
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
if (state.cmdState.length > 0) {
|
28
|
+
return state.cmdState[state.cmdState.length - 1];
|
29
|
+
} else {
|
30
|
+
return null;
|
31
|
+
}
|
32
32
|
}
|
33
33
|
|
34
34
|
function popCommand(state) {
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
var plug = state.cmdState.pop();
|
36
|
+
if (plug) {
|
37
|
+
plug.closeBracket();
|
38
|
+
}
|
39
39
|
}
|
40
40
|
|
41
41
|
// returns the non-default plugin closest to the end of the list
|
42
42
|
function getMostPowerful(state) {
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
43
|
+
var context = state.cmdState;
|
44
|
+
for (var i = context.length - 1; i >= 0; i--) {
|
45
|
+
var plug = context[i];
|
46
|
+
if (plug.name == "DEFAULT") {
|
47
|
+
continue;
|
48
|
+
}
|
49
|
+
return plug;
|
50
|
+
}
|
51
|
+
return { styleIdentifier: function() { return null; } };
|
52
52
|
}
|
53
53
|
|
54
54
|
function addPluginPattern(pluginName, cmdStyle, styles) {
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
};
|
65
|
-
this.openBracket = function() {
|
66
|
-
this.bracketNo++;
|
67
|
-
return "bracket";
|
68
|
-
};
|
69
|
-
this.closeBracket = function() {};
|
55
|
+
return function () {
|
56
|
+
this.name = pluginName;
|
57
|
+
this.bracketNo = 0;
|
58
|
+
this.style = cmdStyle;
|
59
|
+
this.styles = styles;
|
60
|
+
this.argument = null; // \begin and \end have arguments that follow. These are stored in the plugin
|
61
|
+
|
62
|
+
this.styleIdentifier = function() {
|
63
|
+
return this.styles[this.bracketNo - 1] || null;
|
70
64
|
};
|
65
|
+
this.openBracket = function() {
|
66
|
+
this.bracketNo++;
|
67
|
+
return "bracket";
|
68
|
+
};
|
69
|
+
this.closeBracket = function() {};
|
70
|
+
};
|
71
71
|
}
|
72
72
|
|
73
73
|
var plugins = {};
|
@@ -79,184 +79,175 @@ CodeMirror.defineMode("stex", function() {
|
|
79
79
|
plugins["end"] = addPluginPattern("end", "tag", ["atom"]);
|
80
80
|
|
81
81
|
plugins["DEFAULT"] = function () {
|
82
|
-
|
83
|
-
|
82
|
+
this.name = "DEFAULT";
|
83
|
+
this.style = "tag";
|
84
84
|
|
85
|
-
|
85
|
+
this.styleIdentifier = this.openBracket = this.closeBracket = function() {};
|
86
86
|
};
|
87
87
|
|
88
88
|
function setState(state, f) {
|
89
|
-
|
89
|
+
state.f = f;
|
90
90
|
}
|
91
91
|
|
92
92
|
// called when in a normal (no environment) context
|
93
93
|
function normal(source, state) {
|
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
|
-
// special case: % at end of its own line; stay in same state
|
132
|
-
if (!source.eol()) {
|
133
|
-
setState(state, inCComment);
|
134
|
-
}
|
135
|
-
return "comment";
|
136
|
-
}
|
137
|
-
else if (ch == '}' || ch == ']') {
|
138
|
-
plug = peekCommand(state);
|
139
|
-
if (plug) {
|
140
|
-
plug.closeBracket(ch);
|
141
|
-
setState(state, beginParams);
|
142
|
-
} else {
|
143
|
-
return "error";
|
144
|
-
}
|
145
|
-
return "bracket";
|
146
|
-
} else if (ch == '{' || ch == '[') {
|
147
|
-
plug = plugins["DEFAULT"];
|
148
|
-
plug = new plug();
|
149
|
-
pushCommand(state, plug);
|
150
|
-
return "bracket";
|
151
|
-
}
|
152
|
-
else if (/\d/.test(ch)) {
|
153
|
-
source.eatWhile(/[\w.%]/);
|
154
|
-
return "atom";
|
155
|
-
}
|
156
|
-
else {
|
157
|
-
source.eatWhile(/[\w\-_]/);
|
158
|
-
plug = getMostPowerful(state);
|
159
|
-
if (plug.name == 'begin') {
|
160
|
-
plug.argument = source.current();
|
161
|
-
}
|
162
|
-
return plug.styleIdentifier();
|
163
|
-
}
|
164
|
-
}
|
165
|
-
|
166
|
-
function inCComment(source, state) {
|
94
|
+
var plug;
|
95
|
+
// Do we look like '\command' ? If so, attempt to apply the plugin 'command'
|
96
|
+
if (source.match(/^\\[a-zA-Z@]+/)) {
|
97
|
+
var cmdName = source.current().slice(1);
|
98
|
+
plug = plugins[cmdName] || plugins["DEFAULT"];
|
99
|
+
plug = new plug();
|
100
|
+
pushCommand(state, plug);
|
101
|
+
setState(state, beginParams);
|
102
|
+
return plug.style;
|
103
|
+
}
|
104
|
+
|
105
|
+
// escape characters
|
106
|
+
if (source.match(/^\\[$&%#{}_]/)) {
|
107
|
+
return "tag";
|
108
|
+
}
|
109
|
+
|
110
|
+
// white space control characters
|
111
|
+
if (source.match(/^\\[,;!\/\\]/)) {
|
112
|
+
return "tag";
|
113
|
+
}
|
114
|
+
|
115
|
+
// find if we're starting various math modes
|
116
|
+
if (source.match("\\[")) {
|
117
|
+
setState(state, function(source, state){ return inMathMode(source, state, "\\]"); });
|
118
|
+
return "keyword";
|
119
|
+
}
|
120
|
+
if (source.match("$$")) {
|
121
|
+
setState(state, function(source, state){ return inMathMode(source, state, "$$"); });
|
122
|
+
return "keyword";
|
123
|
+
}
|
124
|
+
if (source.match("$")) {
|
125
|
+
setState(state, function(source, state){ return inMathMode(source, state, "$"); });
|
126
|
+
return "keyword";
|
127
|
+
}
|
128
|
+
|
129
|
+
var ch = source.next();
|
130
|
+
if (ch == "%") {
|
167
131
|
source.skipToEnd();
|
168
|
-
setState(state, normal);
|
169
132
|
return "comment";
|
133
|
+
}
|
134
|
+
else if (ch == '}' || ch == ']') {
|
135
|
+
plug = peekCommand(state);
|
136
|
+
if (plug) {
|
137
|
+
plug.closeBracket(ch);
|
138
|
+
setState(state, beginParams);
|
139
|
+
} else {
|
140
|
+
return "error";
|
141
|
+
}
|
142
|
+
return "bracket";
|
143
|
+
} else if (ch == '{' || ch == '[') {
|
144
|
+
plug = plugins["DEFAULT"];
|
145
|
+
plug = new plug();
|
146
|
+
pushCommand(state, plug);
|
147
|
+
return "bracket";
|
148
|
+
}
|
149
|
+
else if (/\d/.test(ch)) {
|
150
|
+
source.eatWhile(/[\w.%]/);
|
151
|
+
return "atom";
|
152
|
+
}
|
153
|
+
else {
|
154
|
+
source.eatWhile(/[\w\-_]/);
|
155
|
+
plug = getMostPowerful(state);
|
156
|
+
if (plug.name == 'begin') {
|
157
|
+
plug.argument = source.current();
|
158
|
+
}
|
159
|
+
return plug.styleIdentifier();
|
160
|
+
}
|
170
161
|
}
|
171
162
|
|
172
163
|
function inMathMode(source, state, endModeSeq) {
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
return "comment";
|
216
|
-
}
|
217
|
-
return "error";
|
164
|
+
if (source.eatSpace()) {
|
165
|
+
return null;
|
166
|
+
}
|
167
|
+
if (source.match(endModeSeq)) {
|
168
|
+
setState(state, normal);
|
169
|
+
return "keyword";
|
170
|
+
}
|
171
|
+
if (source.match(/^\\[a-zA-Z@]+/)) {
|
172
|
+
return "tag";
|
173
|
+
}
|
174
|
+
if (source.match(/^[a-zA-Z]+/)) {
|
175
|
+
return "variable-2";
|
176
|
+
}
|
177
|
+
// escape characters
|
178
|
+
if (source.match(/^\\[$&%#{}_]/)) {
|
179
|
+
return "tag";
|
180
|
+
}
|
181
|
+
// white space control characters
|
182
|
+
if (source.match(/^\\[,;!\/]/)) {
|
183
|
+
return "tag";
|
184
|
+
}
|
185
|
+
// special math-mode characters
|
186
|
+
if (source.match(/^[\^_&]/)) {
|
187
|
+
return "tag";
|
188
|
+
}
|
189
|
+
// non-special characters
|
190
|
+
if (source.match(/^[+\-<>|=,\/@!*:;'"`~#?]/)) {
|
191
|
+
return null;
|
192
|
+
}
|
193
|
+
if (source.match(/^(\d+\.\d*|\d*\.\d+|\d+)/)) {
|
194
|
+
return "number";
|
195
|
+
}
|
196
|
+
var ch = source.next();
|
197
|
+
if (ch == "{" || ch == "}" || ch == "[" || ch == "]" || ch == "(" || ch == ")") {
|
198
|
+
return "bracket";
|
199
|
+
}
|
200
|
+
|
201
|
+
if (ch == "%") {
|
202
|
+
source.skipToEnd();
|
203
|
+
return "comment";
|
204
|
+
}
|
205
|
+
return "error";
|
218
206
|
}
|
219
207
|
|
220
208
|
function beginParams(source, state) {
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
setState(state, normal);
|
227
|
-
return "bracket";
|
228
|
-
}
|
229
|
-
if (/[ \t\r]/.test(ch)) {
|
230
|
-
source.eat(ch);
|
231
|
-
return null;
|
232
|
-
}
|
209
|
+
var ch = source.peek(), lastPlug;
|
210
|
+
if (ch == '{' || ch == '[') {
|
211
|
+
lastPlug = peekCommand(state);
|
212
|
+
lastPlug.openBracket(ch);
|
213
|
+
source.eat(ch);
|
233
214
|
setState(state, normal);
|
234
|
-
|
235
|
-
|
236
|
-
|
215
|
+
return "bracket";
|
216
|
+
}
|
217
|
+
if (/[ \t\r]/.test(ch)) {
|
218
|
+
source.eat(ch);
|
219
|
+
return null;
|
220
|
+
}
|
221
|
+
setState(state, normal);
|
222
|
+
popCommand(state);
|
223
|
+
|
224
|
+
return normal(source, state);
|
237
225
|
}
|
238
226
|
|
239
227
|
return {
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
228
|
+
startState: function() {
|
229
|
+
return {
|
230
|
+
cmdState: [],
|
231
|
+
f: normal
|
232
|
+
};
|
233
|
+
},
|
234
|
+
copyState: function(s) {
|
235
|
+
return {
|
236
|
+
cmdState: s.cmdState.slice(),
|
237
|
+
f: s.f
|
238
|
+
};
|
239
|
+
},
|
240
|
+
token: function(stream, state) {
|
241
|
+
return state.f(stream, state);
|
242
|
+
},
|
243
|
+
blankLine: function(state) {
|
244
|
+
state.f = normal;
|
245
|
+
},
|
246
|
+
lineComment: "%"
|
256
247
|
};
|
257
|
-
});
|
248
|
+
});
|
258
249
|
|
259
|
-
CodeMirror.defineMIME("text/x-stex", "stex");
|
260
|
-
CodeMirror.defineMIME("text/x-latex", "stex");
|
250
|
+
CodeMirror.defineMIME("text/x-stex", "stex");
|
251
|
+
CodeMirror.defineMIME("text/x-latex", "stex");
|
261
252
|
|
262
253
|
});
|