codemirror-rails 3.13 → 3.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/lib/codemirror/rails/version.rb +2 -2
  3. data/vendor/assets/javascripts/codemirror.js +328 -250
  4. data/vendor/assets/javascripts/codemirror/addons/comment/comment.js +7 -6
  5. data/vendor/assets/javascripts/codemirror/addons/edit/closebrackets.js +33 -7
  6. data/vendor/assets/javascripts/codemirror/addons/edit/matchbrackets.js +14 -10
  7. data/vendor/assets/javascripts/codemirror/addons/edit/trailingspace.js +15 -0
  8. data/vendor/assets/javascripts/codemirror/addons/fold/brace-fold.js +70 -17
  9. data/vendor/assets/javascripts/codemirror/addons/fold/foldcode.js +56 -20
  10. data/vendor/assets/javascripts/codemirror/addons/fold/xml-fold.js +135 -39
  11. data/vendor/assets/javascripts/codemirror/addons/hint/html-hint.js +324 -571
  12. data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.js +199 -109
  13. data/vendor/assets/javascripts/codemirror/addons/hint/xml-hint.js +60 -113
  14. data/vendor/assets/javascripts/codemirror/addons/lint/coffeescript-lint.js +24 -0
  15. data/vendor/assets/javascripts/codemirror/addons/merge/merge.js +431 -0
  16. data/vendor/assets/javascripts/codemirror/addons/mode/multiplex.js +7 -1
  17. data/vendor/assets/javascripts/codemirror/addons/search/match-highlighter.js +46 -20
  18. data/vendor/assets/javascripts/codemirror/addons/search/search.js +1 -1
  19. data/vendor/assets/javascripts/codemirror/keymaps/emacs.js +370 -13
  20. data/vendor/assets/javascripts/codemirror/keymaps/extra.js +43 -0
  21. data/vendor/assets/javascripts/codemirror/keymaps/vim.js +535 -214
  22. data/vendor/assets/javascripts/codemirror/modes/clike.js +56 -0
  23. data/vendor/assets/javascripts/codemirror/modes/javascript.js +19 -14
  24. data/vendor/assets/javascripts/codemirror/modes/markdown.js +2 -2
  25. data/vendor/assets/javascripts/codemirror/modes/ruby.js +67 -16
  26. data/vendor/assets/javascripts/codemirror/modes/smarty.js +167 -110
  27. data/vendor/assets/javascripts/codemirror/modes/sql.js +97 -15
  28. data/vendor/assets/javascripts/codemirror/modes/xml.js +14 -18
  29. data/vendor/assets/stylesheets/codemirror.css +0 -1
  30. data/vendor/assets/stylesheets/codemirror/addons/merge/merge.css +82 -0
  31. metadata +7 -2
@@ -1,582 +1,335 @@
1
1
  (function () {
2
- function htmlHint(editor, htmlStructure, getToken) {
3
- var cur = editor.getCursor();
4
- var token = getToken(editor, cur);
5
- var keywords = [];
6
- var i = 0;
7
- var j = 0;
8
- var k = 0;
9
- var from = {line: cur.line, ch: cur.ch};
10
- var to = {line: cur.line, ch: cur.ch};
11
- var flagClean = true;
2
+ var langs = "ab aa af ak sq am ar an hy as av ae ay az bm ba eu be bn bh bi bs br bg my ca ch ce ny zh cv kw co cr hr cs da dv nl dz en eo et ee fo fj fi fr ff gl ka de el gn gu ht ha he hz hi ho hu ia id ie ga ig ik io is it iu ja jv kl kn kr ks kk km ki rw ky kv kg ko ku kj la lb lg li ln lo lt lu lv gv mk mg ms ml mt mi mr mh mn na nv nb nd ne ng nn no ii nr oc oj cu om or os pa pi fa pl ps pt qu rm rn ro ru sa sc sd se sm sg sr gd sn si sk sl so st es su sw ss sv ta te tg th ti bo tk tl tn to tr ts tt tw ty ug uk ur uz ve vi vo wa cy wo fy xh yi yo za zu".split(" ");
3
+ var targets = ["_blank", "_self", "_top", "_parent"];
4
+ var charsets = ["ascii", "utf-8", "utf-16", "latin1", "latin1"];
5
+ var methods = ["get", "post", "put", "delete"];
6
+ var encs = ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"];
7
+ var media = ["all", "screen", "print", "embossed", "braille", "handheld", "print", "projection", "screen", "tty", "tv", "speech",
8
+ "3d-glasses", "resolution [>][<][=] [X]", "device-aspect-ratio: X/Y", "orientation:portrait",
9
+ "orientation:landscape", "device-height: [X]", "device-width: [X]"];
10
+ var s = { attrs: {} }; // Simple tag, reused for a whole lot of tags
12
11
 
13
- var text = editor.getRange({line: 0, ch: 0}, cur);
14
-
15
- var open = text.lastIndexOf('<');
16
- var close = text.lastIndexOf('>');
17
- var tokenString = token.string.replace("<","");
18
-
19
- if(open > close) {
20
- var last = editor.getRange({line: cur.line, ch: cur.ch - 1}, cur);
21
- if(last == "<") {
22
- for(i = 0; i < htmlStructure.length; i++) {
23
- keywords.push(htmlStructure[i].tag);
24
- }
25
- from.ch = token.start + 1;
26
- } else {
27
- var counter = 0;
28
- var found = function(token, type, position) {
29
- counter++;
30
- if(counter > 50) return;
31
- if(token.type == type) {
32
- return token;
33
- } else {
34
- position.ch = token.start;
35
- var newToken = editor.getTokenAt(position);
36
- return found(newToken, type, position);
37
- }
38
- };
39
-
40
- var nodeToken = found(token, "tag", {line: cur.line, ch: cur.ch});
41
- var node = nodeToken.string.substring(1);
42
-
43
- if(token.type === null && token.string.trim() === "") {
44
- for(i = 0; i < htmlStructure.length; i++) {
45
- if(htmlStructure[i].tag == node) {
46
- for(j = 0; j < htmlStructure[i].attr.length; j++) {
47
- keywords.push(htmlStructure[i].attr[j].key + "=\"\" ");
48
- }
49
-
50
- for(k = 0; k < globalAttributes.length; k++) {
51
- keywords.push(globalAttributes[k].key + "=\"\" ");
52
- }
53
- }
54
- }
55
- } else if(token.type == "string") {
56
- tokenString = tokenString.substring(1, tokenString.length - 1);
57
- var attributeToken = found(token, "attribute", {line: cur.line, ch: cur.ch});
58
- var attribute = attributeToken.string;
59
-
60
- for(i = 0; i < htmlStructure.length; i++) {
61
- if(htmlStructure[i].tag == node) {
62
- for(j = 0; j < htmlStructure[i].attr.length; j++) {
63
- if(htmlStructure[i].attr[j].key == attribute) {
64
- for(k = 0; k < htmlStructure[i].attr[j].values.length; k++) {
65
- keywords.push(htmlStructure[i].attr[j].values[k]);
66
- }
67
- }
68
- }
69
-
70
- for(j = 0; j < globalAttributes.length; j++) {
71
- if(globalAttributes[j].key == attribute) {
72
- for(k = 0; k < globalAttributes[j].values.length; k++) {
73
- keywords.push(globalAttributes[j].values[k]);
74
- }
75
- }
76
- }
77
- }
78
- }
79
- from.ch = token.start + 1;
80
- } else if(token.type == "attribute") {
81
- for(i = 0; i < htmlStructure.length; i++) {
82
- if(htmlStructure[i].tag == node) {
83
- for(j = 0; j < htmlStructure[i].attr.length; j++) {
84
- keywords.push(htmlStructure[i].attr[j].key + "=\"\" ");
85
- }
86
-
87
- for(k = 0; k < globalAttributes.length; k++) {
88
- keywords.push(globalAttributes[k].key + "=\"\" ");
89
- }
90
- }
91
- }
92
- from.ch = token.start;
93
- } else if(token.type == "tag") {
94
- for(i = 0; i < htmlStructure.length; i++) {
95
- keywords.push(htmlStructure[i].tag);
96
- }
97
-
98
- from.ch = token.start + 1;
99
- }
12
+ var data = {
13
+ a: {
14
+ attrs: {
15
+ href: null, ping: null, type: null,
16
+ media: media,
17
+ target: targets,
18
+ hreflang: langs
100
19
  }
101
- } else {
102
- for(i = 0; i < htmlStructure.length; i++) {
103
- keywords.push("<" + htmlStructure[i].tag);
20
+ },
21
+ abbr: s,
22
+ acronym: s,
23
+ address: s,
24
+ applet: s,
25
+ area: {
26
+ attrs: {
27
+ alt: null, coords: null, href: null, target: null, ping: null,
28
+ media: media, hreflang: langs, type: null,
29
+ shape: ["default", "rect", "circle", "poly"]
104
30
  }
105
-
106
- tokenString = ("<" + tokenString).trim();
107
- from.ch = token.start;
108
- }
109
-
110
- if(flagClean === true && tokenString.trim() === "") {
111
- flagClean = false;
112
- }
113
-
114
- if(flagClean) {
115
- keywords = cleanResults(tokenString, keywords);
116
- }
117
-
118
- return {list: keywords, from: from, to: to};
119
- }
120
-
121
-
122
- var cleanResults = function(text, keywords) {
123
- var results = [];
124
- var i = 0;
125
-
126
- for(i = 0; i < keywords.length; i++) {
127
- if(keywords[i].substring(0, text.length) == text) {
128
- results.push(keywords[i]);
31
+ },
32
+ article: s,
33
+ aside: s,
34
+ audio: {
35
+ attrs: {
36
+ src: null, mediagroup: null,
37
+ crossorigin: ["anonymous", "use-credentials"],
38
+ preload: ["none", "metadata", "auto"],
39
+ autoplay: ["", "autoplay"],
40
+ loop: ["", "loop"],
41
+ controls: ["", "controls"]
129
42
  }
130
- }
131
-
132
- return results;
43
+ },
44
+ b: s,
45
+ base: { attrs: { href: null, target: targets } },
46
+ basefont: s,
47
+ bdi: s,
48
+ bdo: s,
49
+ big: s,
50
+ blockquote: { attrs: { cite: null } },
51
+ body: s,
52
+ br: s,
53
+ button: {
54
+ attrs: {
55
+ form: null, formaction: null, name: null, value: null,
56
+ autofocus: ["", "autofocus"],
57
+ disabled: ["", "autofocus"],
58
+ formenctype: encs,
59
+ formmethod: methods,
60
+ formnovalidate: ["", "novalidate"],
61
+ formtarget: targets,
62
+ type: ["submit", "reset", "button"]
63
+ }
64
+ },
65
+ canvas: { attrs: { width: null, height: null } },
66
+ caption: s,
67
+ center: s,
68
+ cite: s,
69
+ code: s,
70
+ col: { attrs: { span: null } },
71
+ colgroup: { attrs: { span: null } },
72
+ command: {
73
+ attrs: {
74
+ type: ["command", "checkbox", "radio"],
75
+ label: null, icon: null, radiogroup: null, command: null, title: null,
76
+ disabled: ["", "disabled"],
77
+ checked: ["", "checked"]
78
+ }
79
+ },
80
+ data: { attrs: { value: null } },
81
+ datagrid: { attrs: { disabled: ["", "disabled"], multiple: ["", "multiple"] } },
82
+ datalist: { attrs: { data: null } },
83
+ dd: s,
84
+ del: { attrs: { cite: null, datetime: null } },
85
+ details: { attrs: { open: ["", "open"] } },
86
+ dfn: s,
87
+ dir: s,
88
+ div: s,
89
+ dl: s,
90
+ dt: s,
91
+ em: s,
92
+ embed: { attrs: { src: null, type: null, width: null, height: null } },
93
+ eventsource: { attrs: { src: null } },
94
+ fieldset: { attrs: { disabled: ["", "disabled"], form: null, name: null } },
95
+ figcaption: s,
96
+ figure: s,
97
+ font: s,
98
+ footer: s,
99
+ form: {
100
+ attrs: {
101
+ action: null, name: null,
102
+ "accept-charset": charsets,
103
+ autocomplete: ["on", "off"],
104
+ enctype: encs,
105
+ method: methods,
106
+ novalidate: ["", "novalidate"],
107
+ target: targets
108
+ }
109
+ },
110
+ frame: s,
111
+ frameset: s,
112
+ h1: s, h2: s, h3: s, h4: s, h5: s, h6: s,
113
+ head: {
114
+ attrs: {},
115
+ children: ["title", "base", "link", "style", "meta", "script", "noscript", "command"]
116
+ },
117
+ header: s,
118
+ hgroup: s,
119
+ hr: s,
120
+ html: {
121
+ attrs: { manifest: null },
122
+ children: ["head", "body"]
123
+ },
124
+ i: s,
125
+ iframe: {
126
+ attrs: {
127
+ src: null, srcdoc: null, name: null, width: null, height: null,
128
+ sandbox: ["allow-top-navigation", "allow-same-origin", "allow-forms", "allow-scripts"],
129
+ seamless: ["", "seamless"]
130
+ }
131
+ },
132
+ img: {
133
+ attrs: {
134
+ alt: null, src: null, ismap: null, usemap: null, width: null, height: null,
135
+ crossorigin: ["anonymous", "use-credentials"]
136
+ }
137
+ },
138
+ input: {
139
+ attrs: {
140
+ alt: null, dirname: null, form: null, formaction: null,
141
+ height: null, list: null, max: null, maxlength: null, min: null,
142
+ name: null, pattern: null, placeholder: null, size: null, src: null,
143
+ step: null, value: null, width: null,
144
+ accept: ["audio/*", "video/*", "image/*"],
145
+ autocomplete: ["on", "off"],
146
+ autofocus: ["", "autofocus"],
147
+ checked: ["", "checked"],
148
+ disabled: ["", "disabled"],
149
+ formenctype: encs,
150
+ formmethod: methods,
151
+ formnovalidate: ["", "novalidate"],
152
+ formtarget: targets,
153
+ multiple: ["", "multiple"],
154
+ readonly: ["", "readonly"],
155
+ required: ["", "required"],
156
+ type: ["hidden", "text", "search", "tel", "url", "email", "password", "datetime", "date", "month",
157
+ "week", "time", "datetime-local", "number", "range", "color", "checkbox", "radio",
158
+ "file", "submit", "image", "reset", "button"]
159
+ }
160
+ },
161
+ ins: { attrs: { cite: null, datetime: null } },
162
+ kbd: s,
163
+ keygen: {
164
+ attrs: {
165
+ challenge: null, form: null, name: null,
166
+ autofocus: ["", "autofocus"],
167
+ disabled: ["", "disabled"],
168
+ keytype: ["RSA"]
169
+ }
170
+ },
171
+ label: { attrs: { "for": null, form: null } },
172
+ legend: s,
173
+ li: { attrs: { value: null } },
174
+ link: {
175
+ attrs: {
176
+ href: null, type: null,
177
+ hreflang: langs,
178
+ media: media,
179
+ sizes: ["all", "16x16", "16x16 32x32", "16x16 32x32 64x64"]
180
+ }
181
+ },
182
+ map: { attrs: { name: null } },
183
+ mark: s,
184
+ menu: { attrs: { label: null, type: ["list", "context", "toolbar"] } },
185
+ meta: {
186
+ attrs: {
187
+ content: null,
188
+ charset: charsets,
189
+ name: ["viewport", "application-name", "author", "description", "generator", "keywords"],
190
+ "http-equiv": ["content-language", "content-type", "default-style", "refresh"]
191
+ }
192
+ },
193
+ meter: { attrs: { value: null, min: null, low: null, high: null, max: null, optimum: null } },
194
+ nav: s,
195
+ noframes: s,
196
+ noscript: s,
197
+ object: {
198
+ attrs: {
199
+ data: null, type: null, name: null, usemap: null, form: null, width: null, height: null,
200
+ typemustmatch: ["", "typemustmatch"]
201
+ }
202
+ },
203
+ ol: { attrs: { reversed: ["", "reversed"], start: null, type: ["1", "a", "A", "i", "I"] } },
204
+ optgroup: { attrs: { disabled: ["", "disabled"], label: null } },
205
+ option: { attrs: { disabled: ["", "disabled"], label: null, selected: ["", "selected"], value: null } },
206
+ output: { attrs: { "for": null, form: null, name: null } },
207
+ p: s,
208
+ param: { attrs: { name: null, value: null } },
209
+ pre: s,
210
+ progress: { attrs: { value: null, max: null } },
211
+ q: { attrs: { cite: null } },
212
+ rp: s,
213
+ rt: s,
214
+ ruby: s,
215
+ s: s,
216
+ samp: s,
217
+ script: {
218
+ attrs: {
219
+ type: ["text/javascript"],
220
+ src: null,
221
+ async: ["", "async"],
222
+ defer: ["", "defer"],
223
+ charset: charsets
224
+ }
225
+ },
226
+ section: s,
227
+ select: {
228
+ attrs: {
229
+ form: null, name: null, size: null,
230
+ autofocus: ["", "autofocus"],
231
+ disabled: ["", "disabled"],
232
+ multiple: ["", "multiple"]
233
+ }
234
+ },
235
+ small: s,
236
+ source: { attrs: { src: null, type: null, media: null } },
237
+ span: s,
238
+ strike: s,
239
+ strong: s,
240
+ style: {
241
+ attrs: {
242
+ type: ["text/css"],
243
+ media: media,
244
+ scoped: null
245
+ }
246
+ },
247
+ sub: s,
248
+ summary: s,
249
+ sup: s,
250
+ table: s,
251
+ tbody: s,
252
+ td: { attrs: { colspan: null, rowspan: null, headers: null } },
253
+ textarea: {
254
+ attrs: {
255
+ dirname: null, form: null, maxlength: null, name: null, placeholder: null,
256
+ rows: null, cols: null,
257
+ autofocus: ["", "autofocus"],
258
+ disabled: ["", "disabled"],
259
+ readonly: ["", "readonly"],
260
+ required: ["", "required"],
261
+ wrap: ["soft", "hard"]
262
+ }
263
+ },
264
+ tfoot: s,
265
+ th: { attrs: { colspan: null, rowspan: null, headers: null, scope: ["row", "col", "rowgroup", "colgroup"] } },
266
+ thead: s,
267
+ time: { attrs: { datetime: null } },
268
+ title: s,
269
+ tr: s,
270
+ track: {
271
+ attrs: {
272
+ src: null, label: null, "default": null,
273
+ kind: ["subtitles", "captions", "descriptions", "chapters", "metadata"],
274
+ srclang: langs
275
+ }
276
+ },
277
+ tt: s,
278
+ u: s,
279
+ ul: s,
280
+ "var": s,
281
+ video: {
282
+ attrs: {
283
+ src: null, poster: null, width: null, height: null,
284
+ crossorigin: ["anonymous", "use-credentials"],
285
+ preload: ["auto", "metadata", "none"],
286
+ autoplay: ["", "autoplay"],
287
+ mediagroup: ["movie"],
288
+ muted: ["", "muted"],
289
+ controls: ["", "controls"]
290
+ }
291
+ },
292
+ wbr: s
133
293
  };
134
294
 
135
- var htmlStructure = [
136
- {tag: '!DOCTYPE', attr: []},
137
- {tag: 'a', attr: [
138
- {key: 'href', values: ["#"]},
139
- {key: 'target', values: ["_blank","_self","_top","_parent"]},
140
- {key: 'ping', values: [""]},
141
- {key: 'media', values: ["#"]},
142
- {key: 'hreflang', values: ["en","es"]},
143
- {key: 'type', values: []}
144
- ]},
145
- {tag: 'abbr', attr: []},
146
- {tag: 'acronym', attr: []},
147
- {tag: 'address', attr: []},
148
- {tag: 'applet', attr: []},
149
- {tag: 'area', attr: [
150
- {key: 'alt', values: [""]},
151
- {key: 'coords', values: ["rect: left, top, right, bottom","circle: center-x, center-y, radius","poly: x1, y1, x2, y2, ..."]},
152
- {key: 'shape', values: ["default","rect","circle","poly"]},
153
- {key: 'href', values: ["#"]},
154
- {key: 'target', values: ["#"]},
155
- {key: 'ping', values: []},
156
- {key: 'media', values: []},
157
- {key: 'hreflang', values: []},
158
- {key: 'type', values: []}
159
-
160
- ]},
161
- {tag: 'article', attr: []},
162
- {tag: 'aside', attr: []},
163
- {tag: 'audio', attr: [
164
- {key: 'src', values: []},
165
- {key: 'crossorigin', values: ["anonymous","use-credentials"]},
166
- {key: 'preload', values: ["none","metadata","auto"]},
167
- {key: 'autoplay', values: ["","autoplay"]},
168
- {key: 'mediagroup', values: []},
169
- {key: 'loop', values: ["","loop"]},
170
- {key: 'controls', values: ["","controls"]}
171
- ]},
172
- {tag: 'b', attr: []},
173
- {tag: 'base', attr: [
174
- {key: 'href', values: ["#"]},
175
- {key: 'target', values: ["_blank","_self","_top","_parent"]}
176
- ]},
177
- {tag: 'basefont', attr: []},
178
- {tag: 'bdi', attr: []},
179
- {tag: 'bdo', attr: []},
180
- {tag: 'big', attr: []},
181
- {tag: 'blockquote', attr: [
182
- {key: 'cite', values: ["http://"]}
183
- ]},
184
- {tag: 'body', attr: []},
185
- {tag: 'br', attr: []},
186
- {tag: 'button', attr: [
187
- {key: 'autofocus', values: ["","autofocus"]},
188
- {key: 'disabled', values: ["","disabled"]},
189
- {key: 'form', values: []},
190
- {key: 'formaction', values: []},
191
- {key: 'formenctype', values: ["application/x-www-form-urlencoded","multipart/form-data","text/plain"]},
192
- {key: 'formmethod', values: ["get","post","put","delete"]},
193
- {key: 'formnovalidate', values: ["","novalidate"]},
194
- {key: 'formtarget', values: ["_blank","_self","_top","_parent"]},
195
- {key: 'name', values: []},
196
- {key: 'type', values: ["submit","reset","button"]},
197
- {key: 'value', values: []}
198
- ]},
199
- {tag: 'canvas', attr: [
200
- {key: 'width', values: []},
201
- {key: 'height', values: []}
202
- ]},
203
- {tag: 'caption', attr: []},
204
- {tag: 'center', attr: []},
205
- {tag: 'cite', attr: []},
206
- {tag: 'code', attr: []},
207
- {tag: 'col', attr: [
208
- {key: 'span', values: []}
209
- ]},
210
- {tag: 'colgroup', attr: [
211
- {key: 'span', values: []}
212
- ]},
213
- {tag: 'command', attr: [
214
- {key: 'type', values: ["command","checkbox","radio"]},
215
- {key: 'label', values: []},
216
- {key: 'icon', values: []},
217
- {key: 'disabled', values: ["","disabled"]},
218
- {key: 'checked', values: ["","checked"]},
219
- {key: 'radiogroup', values: []},
220
- {key: 'command', values: []},
221
- {key: 'title', values: []}
222
- ]},
223
- {tag: 'data', attr: [
224
- {key: 'value', values: []}
225
- ]},
226
- {tag: 'datagrid', attr: [
227
- {key: 'disabled', values: ["","disabled"]},
228
- {key: 'multiple', values: ["","multiple"]}
229
- ]},
230
- {tag: 'datalist', attr: [
231
- {key: 'data', values: []}
232
- ]},
233
- {tag: 'dd', attr: []},
234
- {tag: 'del', attr: [
235
- {key: 'cite', values: []},
236
- {key: 'datetime', values: []}
237
- ]},
238
- {tag: 'details', attr: [
239
- {key: 'open', values: ["","open"]}
240
- ]},
241
- {tag: 'dfn', attr: []},
242
- {tag: 'dir', attr: []},
243
- {tag: 'div', attr: [
244
- {key: 'id', values: []},
245
- {key: 'class', values: []},
246
- {key: 'style', values: []}
247
- ]},
248
- {tag: 'dl', attr: []},
249
- {tag: 'dt', attr: []},
250
- {tag: 'em', attr: []},
251
- {tag: 'embed', attr: [
252
- {key: 'src', values: []},
253
- {key: 'type', values: []},
254
- {key: 'width', values: []},
255
- {key: 'height', values: []}
256
- ]},
257
- {tag: 'eventsource', attr: [
258
- {key: 'src', values: []}
259
- ]},
260
- {tag: 'fieldset', attr: [
261
- {key: 'disabled', values: ["","disabled"]},
262
- {key: 'form', values: []},
263
- {key: 'name', values: []}
264
- ]},
265
- {tag: 'figcaption', attr: []},
266
- {tag: 'figure', attr: []},
267
- {tag: 'font', attr: []},
268
- {tag: 'footer', attr: []},
269
- {tag: 'form', attr: [
270
- {key: 'accept-charset', values: ["UNKNOWN","utf-8"]},
271
- {key: 'action', values: []},
272
- {key: 'autocomplete', values: ["on","off"]},
273
- {key: 'enctype', values: ["application/x-www-form-urlencoded","multipart/form-data","text/plain"]},
274
- {key: 'method', values: ["get","post","put","delete","dialog"]},
275
- {key: 'name', values: []},
276
- {key: 'novalidate', values: ["","novalidate"]},
277
- {key: 'target', values: ["_blank","_self","_top","_parent"]}
278
- ]},
279
- {tag: 'frame', attr: []},
280
- {tag: 'frameset', attr: []},
281
- {tag: 'h1', attr: []},
282
- {tag: 'h2', attr: []},
283
- {tag: 'h3', attr: []},
284
- {tag: 'h4', attr: []},
285
- {tag: 'h5', attr: []},
286
- {tag: 'h6', attr: []},
287
- {tag: 'head', attr: []},
288
- {tag: 'header', attr: []},
289
- {tag: 'hgroup', attr: []},
290
- {tag: 'hr', attr: []},
291
- {tag: 'html', attr: [
292
- {key: 'manifest', values: []}
293
- ]},
294
- {tag: 'i', attr: []},
295
- {tag: 'iframe', attr: [
296
- {key: 'src', values: []},
297
- {key: 'srcdoc', values: []},
298
- {key: 'name', values: []},
299
- {key: 'sandbox', values: ["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"]},
300
- {key: 'seamless', values: ["","seamless"]},
301
- {key: 'width', values: []},
302
- {key: 'height', values: []}
303
- ]},
304
- {tag: 'img', attr: [
305
- {key: 'alt', values: []},
306
- {key: 'src', values: []},
307
- {key: 'crossorigin', values: ["anonymous","use-credentials"]},
308
- {key: 'ismap', values: []},
309
- {key: 'usemap', values: []},
310
- {key: 'width', values: []},
311
- {key: 'height', values: []}
312
- ]},
313
- {tag: 'input', attr: [
314
- {key: 'accept', values: ["audio/*","video/*","image/*"]},
315
- {key: 'alt', values: []},
316
- {key: 'autocomplete', values: ["on","off"]},
317
- {key: 'autofocus', values: ["","autofocus"]},
318
- {key: 'checked', values: ["","checked"]},
319
- {key: 'disabled', values: ["","disabled"]},
320
- {key: 'dirname', values: []},
321
- {key: 'form', values: []},
322
- {key: 'formaction', values: []},
323
- {key: 'formenctype', values: ["application/x-www-form-urlencoded","multipart/form-data","text/plain"]},
324
- {key: 'formmethod', values: ["get","post","put","delete"]},
325
- {key: 'formnovalidate', values: ["","novalidate"]},
326
- {key: 'formtarget', values: ["_blank","_self","_top","_parent"]},
327
- {key: 'height', values: []},
328
- {key: 'list', values: []},
329
- {key: 'max', values: []},
330
- {key: 'maxlength', values: []},
331
- {key: 'min', values: []},
332
- {key: 'multiple', values: ["","multiple"]},
333
- {key: 'name', values: []},
334
- {key: 'pattern', values: []},
335
- {key: 'placeholder', values: []},
336
- {key: 'readonly', values: ["","readonly"]},
337
- {key: 'required', values: ["","required"]},
338
- {key: 'size', values: []},
339
- {key: 'src', values: []},
340
- {key: 'step', values: []},
341
- {key: 'type', values: [
342
- "hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local",
343
- "number","range","color","checkbox","radio","file","submit","image","reset","button"
344
- ]},
345
- {key: 'value', values: []},
346
- {key: 'width', values: []}
347
- ]},
348
- {tag: 'ins', attr: [
349
- {key: 'cite', values: []},
350
- {key: 'datetime', values: []}
351
- ]},
352
- {tag: 'kbd', attr: []},
353
- {tag: 'keygen', attr: [
354
- {key: 'autofocus', values: ["","autofocus"]},
355
- {key: 'challenge', values: []},
356
- {key: 'disabled', values: ["","disabled"]},
357
- {key: 'form', values: []},
358
- {key: 'keytype', values: ["RSA"]},
359
- {key: 'name', values: []}
360
- ]},
361
- {tag: 'label', attr: [
362
- {key: 'for', values: []},
363
- {key: 'form', values: []}
364
- ]},
365
- {tag: 'legend', attr: []},
366
- {tag: 'li', attr: [
367
- {key: 'value', values: []}
368
- ]},
369
- {tag: 'link', attr: [
370
- {key: 'href', values: []},
371
- {key: 'hreflang', values: ["en","es"]},
372
- {key: 'media', values: [
373
- "all","screen","print","embossed","braille","handheld","print","projection","screen","tty","tv","speech","3d-glasses",
374
- "resolution [>][<][=] [X]dpi","resolution [>][<][=] [X]dpcm","device-aspect-ratio: 16/9","device-aspect-ratio: 4/3",
375
- "device-aspect-ratio: 32/18","device-aspect-ratio: 1280/720","device-aspect-ratio: 2560/1440","orientation:portrait",
376
- "orientation:landscape","device-height: [X]px","device-width: [X]px","-webkit-min-device-pixel-ratio: 2"
377
- ]},
378
- {key: 'type', values: []},
379
- {key: 'sizes', values: ["all","16x16","16x16 32x32","16x16 32x32 64x64"]}
380
- ]},
381
- {tag: 'map', attr: [
382
- {key: 'name', values: []}
383
- ]},
384
- {tag: 'mark', attr: []},
385
- {tag: 'menu', attr: [
386
- {key: 'type', values: ["list","context","toolbar"]},
387
- {key: 'label', values: []}
388
- ]},
389
- {tag: 'meta', attr: [
390
- {key: 'charset', attr: ["utf-8"]},
391
- {key: 'name', attr: ["viewport","application-name","author","description","generator","keywords"]},
392
- {key: 'content', attr: ["","width=device-width","initial-scale=1, maximum-scale=1, minimun-scale=1, user-scale=no"]},
393
- {key: 'http-equiv', attr: ["content-language","content-type","default-style","refresh"]}
394
- ]},
395
- {tag: 'meter', attr: [
396
- {key: 'value', values: []},
397
- {key: 'min', values: []},
398
- {key: 'low', values: []},
399
- {key: 'high', values: []},
400
- {key: 'max', values: []},
401
- {key: 'optimum', values: []}
402
- ]},
403
- {tag: 'nav', attr: []},
404
- {tag: 'noframes', attr: []},
405
- {tag: 'noscript', attr: []},
406
- {tag: 'object', attr: [
407
- {key: 'data', values: []},
408
- {key: 'type', values: []},
409
- {key: 'typemustmatch', values: ["","typemustmatch"]},
410
- {key: 'name', values: []},
411
- {key: 'usemap', values: []},
412
- {key: 'form', values: []},
413
- {key: 'width', values: []},
414
- {key: 'height', values: []}
415
- ]},
416
- {tag: 'ol', attr: [
417
- {key: 'reversed', values: ["", "reversed"]},
418
- {key: 'start', values: []},
419
- {key: 'type', values: ["1","a","A","i","I"]}
420
- ]},
421
- {tag: 'optgroup', attr: [
422
- {key: 'disabled', values: ["","disabled"]},
423
- {key: 'label', values: []}
424
- ]},
425
- {tag: 'option', attr: [
426
- {key: 'disabled', values: ["", "disabled"]},
427
- {key: 'label', values: []},
428
- {key: 'selected', values: ["", "selected"]},
429
- {key: 'value', values: []}
430
- ]},
431
- {tag: 'output', attr: [
432
- {key: 'for', values: []},
433
- {key: 'form', values: []},
434
- {key: 'name', values: []}
435
- ]},
436
- {tag: 'p', attr: []},
437
- {tag: 'param', attr: [
438
- {key: 'name', values: []},
439
- {key: 'value', values: []}
440
- ]},
441
- {tag: 'pre', attr: []},
442
- {tag: 'progress', attr: [
443
- {key: 'value', values: []},
444
- {key: 'max', values: []}
445
- ]},
446
- {tag: 'q', attr: [
447
- {key: 'cite', values: []}
448
- ]},
449
- {tag: 'rp', attr: []},
450
- {tag: 'rt', attr: []},
451
- {tag: 'ruby', attr: []},
452
- {tag: 's', attr: []},
453
- {tag: 'samp', attr: []},
454
- {tag: 'script', attr: [
455
- {key: 'type', values: ["text/javascript"]},
456
- {key: 'src', values: []},
457
- {key: 'async', values: ["","async"]},
458
- {key: 'defer', values: ["","defer"]},
459
- {key: 'charset', values: ["utf-8"]}
460
- ]},
461
- {tag: 'section', attr: []},
462
- {tag: 'select', attr: [
463
- {key: 'autofocus', values: ["", "autofocus"]},
464
- {key: 'disabled', values: ["", "disabled"]},
465
- {key: 'form', values: []},
466
- {key: 'multiple', values: ["", "multiple"]},
467
- {key: 'name', values: []},
468
- {key: 'size', values: []}
469
- ]},
470
- {tag: 'small', attr: []},
471
- {tag: 'source', attr: [
472
- {key: 'src', values: []},
473
- {key: 'type', values: []},
474
- {key: 'media', values: []}
475
- ]},
476
- {tag: 'span', attr: []},
477
- {tag: 'strike', attr: []},
478
- {tag: 'strong', attr: []},
479
- {tag: 'style', attr: [
480
- {key: 'type', values: ["text/css"]},
481
- {key: 'media', values: ["all","braille","print","projection","screen","speech"]},
482
- {key: 'scoped', values: []}
483
- ]},
484
- {tag: 'sub', attr: []},
485
- {tag: 'summary', attr: []},
486
- {tag: 'sup', attr: []},
487
- {tag: 'table', attr: [
488
- {key: 'border', values: []}
489
- ]},
490
- {tag: 'tbody', attr: []},
491
- {tag: 'td', attr: [
492
- {key: 'colspan', values: []},
493
- {key: 'rowspan', values: []},
494
- {key: 'headers', values: []}
495
- ]},
496
- {tag: 'textarea', attr: [
497
- {key: 'autofocus', values: ["","autofocus"]},
498
- {key: 'disabled', values: ["","disabled"]},
499
- {key: 'dirname', values: []},
500
- {key: 'form', values: []},
501
- {key: 'maxlength', values: []},
502
- {key: 'name', values: []},
503
- {key: 'placeholder', values: []},
504
- {key: 'readonly', values: ["","readonly"]},
505
- {key: 'required', values: ["","required"]},
506
- {key: 'rows', values: []},
507
- {key: 'cols', values: []},
508
- {key: 'wrap', values: ["soft","hard"]}
509
- ]},
510
- {tag: 'tfoot', attr: []},
511
- {tag: 'th', attr: [
512
- {key: 'colspan', values: []},
513
- {key: 'rowspan', values: []},
514
- {key: 'headers', values: []},
515
- {key: 'scope', values: ["row","col","rowgroup","colgroup"]}
516
- ]},
517
- {tag: 'thead', attr: []},
518
- {tag: 'time', attr: [
519
- {key: 'datetime', values: []}
520
- ]},
521
- {tag: 'title', attr: []},
522
- {tag: 'tr', attr: []},
523
- {tag: 'track', attr: [
524
- {key: 'kind', values: ["subtitles","captions","descriptions","chapters","metadata"]},
525
- {key: 'src', values: []},
526
- {key: 'srclang', values: ["en","es"]},
527
- {key: 'label', values: []},
528
- {key: 'default', values: []}
529
- ]},
530
- {tag: 'tt', attr: []},
531
- {tag: 'u', attr: []},
532
- {tag: 'ul', attr: []},
533
- {tag: 'var', attr: []},
534
- {tag: 'video', attr: [
535
- {key: "src", values: []},
536
- {key: "crossorigin", values: ["anonymous","use-credentials"]},
537
- {key: "poster", values: []},
538
- {key: "preload", values: ["auto","metadata","none"]},
539
- {key: "autoplay", values: ["","autoplay"]},
540
- {key: "mediagroup", values: ["movie"]},
541
- {key: "loop", values: ["","loop"]},
542
- {key: "muted", values: ["","muted"]},
543
- {key: "controls", values: ["","controls"]},
544
- {key: "width", values: []},
545
- {key: "height", values: []}
546
- ]},
547
- {tag: 'wbr', attr: []}
548
- ];
295
+ var globalAttrs = {
296
+ accesskey: ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
297
+ "class": null,
298
+ contenteditable: ["true", "false"],
299
+ contextmenu: null,
300
+ dir: ["ltr", "rtl", "auto"],
301
+ draggable: ["true", "false", "auto"],
302
+ dropzone: ["copy", "move", "link", "string:", "file:"],
303
+ hidden: ["hidden"],
304
+ id: null,
305
+ inert: ["inert"],
306
+ itemid: null,
307
+ itemprop: null,
308
+ itemref: null,
309
+ itemscope: ["itemscope"],
310
+ itemtype: null,
311
+ lang: ["en", "es"],
312
+ spellcheck: ["true", "false"],
313
+ style: null,
314
+ tabindex: ["1", "2", "3", "4", "5", "6", "7", "8", "9"],
315
+ title: null,
316
+ translate: ["yes", "no"],
317
+ onclick: null,
318
+ rel: ["stylesheet", "alternate", "author", "bookmark", "help", "license", "next", "nofollow", "noreferrer", "prefetch", "prev", "search", "tag"]
319
+ };
320
+ function populate(obj) {
321
+ for (var attr in globalAttrs) if (globalAttrs.hasOwnProperty(attr))
322
+ obj.attrs[attr] = globalAttrs[attr];
323
+ }
549
324
 
550
- var globalAttributes = [
551
- {key: "accesskey", values: ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"]},
552
- {key: "class", values: []},
553
- {key: "contenteditable", values: ["true", "false"]},
554
- {key: "contextmenu", values: []},
555
- {key: "dir", values: ["ltr","rtl","auto"]},
556
- {key: "draggable", values: ["true","false","auto"]},
557
- {key: "dropzone", values: ["copy","move","link","string:","file:"]},
558
- {key: "hidden", values: ["hidden"]},
559
- {key: "id", values: []},
560
- {key: "inert", values: ["inert"]},
561
- {key: "itemid", values: []},
562
- {key: "itemprop", values: []},
563
- {key: "itemref", values: []},
564
- {key: "itemscope", values: ["itemscope"]},
565
- {key: "itemtype", values: []},
566
- {key: "lang", values: ["en","es"]},
567
- {key: "spellcheck", values: ["true","false"]},
568
- {key: "style", values: []},
569
- {key: "tabindex", values: ["1","2","3","4","5","6","7","8","9"]},
570
- {key: "title", values: []},
571
- {key: "translate", values: ["yes","no"]},
572
- {key: "onclick", values: []},
573
- {key: 'rel', values: ["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"]}
574
- ];
325
+ populate(s);
326
+ for (var tag in data) if (data.hasOwnProperty(tag) && data[tag] != s)
327
+ populate(data[tag]);
575
328
 
576
- CodeMirror.htmlHint = function(editor) {
577
- if(String.prototype.trim == undefined) {
578
- String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g, '');};
579
- }
580
- return htmlHint(editor, htmlStructure, function (e, cur) { return e.getTokenAt(cur); });
329
+ CodeMirror.htmlSchema = data;
330
+ CodeMirror.htmlHint = function(cm, options) {
331
+ var local = {schemaInfo: data};
332
+ if (options) for (var opt in options) local[opt] = options[opt];
333
+ return CodeMirror.xmlHint(cm, local);
581
334
  };
582
335
  })();