diff options
author | Nivesh Rajbhandari | 2012-03-12 16:25:28 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-03-12 16:25:28 -0700 |
commit | 5fb358d9e80a364d5f300d60b7a9fe0f773741e7 (patch) | |
tree | 2c4d5292b19c91697dffb542f369ec9dcb340f77 /imports/codemirror/mode/xml | |
parent | 5f9b67be3b8bdb391d021103c6bcee6be2f6cdf4 (diff) | |
parent | 69d90467865a1384725b2301901be2180c5a841f (diff) | |
download | ninja-5fb358d9e80a364d5f300d60b7a9fe0f773741e7.tar.gz |
Merge branch 'refs/heads/ninja-internal' into ToolFixes
Diffstat (limited to 'imports/codemirror/mode/xml')
-rw-r--r--[-rwxr-xr-x] | imports/codemirror/mode/xml/index.html | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | imports/codemirror/mode/xml/xml.js | 35 |
2 files changed, 25 insertions, 10 deletions
diff --git a/imports/codemirror/mode/xml/index.html b/imports/codemirror/mode/xml/index.html index 3b6d6af1..3b6d6af1 100755..100644 --- a/imports/codemirror/mode/xml/index.html +++ b/imports/codemirror/mode/xml/index.html | |||
diff --git a/imports/codemirror/mode/xml/xml.js b/imports/codemirror/mode/xml/xml.js index 71e0e2b0..f467bddc 100755..100644 --- a/imports/codemirror/mode/xml/xml.js +++ b/imports/codemirror/mode/xml/xml.js | |||
@@ -4,8 +4,9 @@ CodeMirror.defineMode("xml", function(config, parserConfig) { | |||
4 | autoSelfClosers: {"br": true, "img": true, "hr": true, "link": true, "input": true, | 4 | autoSelfClosers: {"br": true, "img": true, "hr": true, "link": true, "input": true, |
5 | "meta": true, "col": true, "frame": true, "base": true, "area": true}, | 5 | "meta": true, "col": true, "frame": true, "base": true, "area": true}, |
6 | doNotIndent: {"pre": true}, | 6 | doNotIndent: {"pre": true}, |
7 | allowUnquoted: true | 7 | allowUnquoted: true, |
8 | } : {autoSelfClosers: {}, doNotIndent: {}, allowUnquoted: false}; | 8 | allowMissing: false |
9 | } : {autoSelfClosers: {}, doNotIndent: {}, allowUnquoted: false, allowMissing: false}; | ||
9 | var alignCDATA = parserConfig.alignCDATA; | 10 | var alignCDATA = parserConfig.alignCDATA; |
10 | 11 | ||
11 | // Return variables for tokenizers | 12 | // Return variables for tokenizers |
@@ -47,9 +48,17 @@ CodeMirror.defineMode("xml", function(config, parserConfig) { | |||
47 | } | 48 | } |
48 | } | 49 | } |
49 | else if (ch == "&") { | 50 | else if (ch == "&") { |
50 | stream.eatWhile(/[^;]/); | 51 | var ok; |
51 | stream.eat(";"); | 52 | if (stream.eat("#")) { |
52 | return "atom"; | 53 | if (stream.eat("x")) { |
54 | ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";"); | ||
55 | } else { | ||
56 | ok = stream.eatWhile(/[\d]/) && stream.eat(";"); | ||
57 | } | ||
58 | } else { | ||
59 | ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";"); | ||
60 | } | ||
61 | return ok ? "atom" : "error"; | ||
53 | } | 62 | } |
54 | else { | 63 | else { |
55 | stream.eatWhile(/[^&<]/); | 64 | stream.eatWhile(/[^&<]/); |
@@ -181,15 +190,21 @@ CodeMirror.defineMode("xml", function(config, parserConfig) { | |||
181 | } | 190 | } |
182 | 191 | ||
183 | function attributes(type) { | 192 | function attributes(type) { |
184 | if (type == "word") {setStyle = "attribute"; return cont(attributes);} | 193 | if (type == "word") {setStyle = "attribute"; return cont(attribute, attributes);} |
194 | if (type == "endTag" || type == "selfcloseTag") return pass(); | ||
195 | setStyle = "error"; | ||
196 | return cont(attributes); | ||
197 | } | ||
198 | function attribute(type) { | ||
185 | if (type == "equals") return cont(attvalue, attributes); | 199 | if (type == "equals") return cont(attvalue, attributes); |
186 | if (type == "string") {setStyle = "error"; return cont(attributes);} | 200 | if (!Kludges.allowMissing) setStyle = "error"; |
187 | return pass(); | 201 | return (type == "endTag" || type == "selfcloseTag") ? pass() : cont(); |
188 | } | 202 | } |
189 | function attvalue(type) { | 203 | function attvalue(type) { |
190 | if (type == "word" && Kludges.allowUnquoted) {setStyle = "string"; return cont();} | ||
191 | if (type == "string") return cont(attvaluemaybe); | 204 | if (type == "string") return cont(attvaluemaybe); |
192 | return pass(); | 205 | if (type == "word" && Kludges.allowUnquoted) {setStyle = "string"; return cont();} |
206 | setStyle = "error"; | ||
207 | return (type == "endTag" || type == "selfCloseTag") ? pass() : cont(); | ||
193 | } | 208 | } |
194 | function attvaluemaybe(type) { | 209 | function attvaluemaybe(type) { |
195 | if (type == "string") return cont(attvaluemaybe); | 210 | if (type == "string") return cont(attvaluemaybe); |