diff options
author | Jon Reid | 2012-05-15 11:24:53 -0700 |
---|---|---|
committer | Jon Reid | 2012-05-15 11:24:53 -0700 |
commit | 3e02135df2ee028ae43d0e2456c04e24ecee0e86 (patch) | |
tree | d6dcab6756e3da0038a39527cfe0f9ca89e92310 /imports/codemirror/mode/properties | |
parent | 53a604d0ccb1315576b94406cf3b0b958162307b (diff) | |
parent | e33a4e58c271a9507082694a5268b840fdd05968 (diff) | |
download | ninja-3e02135df2ee028ae43d0e2456c04e24ecee0e86.tar.gz |
Merge branch 'timeline-local' into timeline-multiselect
Conflicts:
js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
resolved using theirs. (selectLayers)
Diffstat (limited to 'imports/codemirror/mode/properties')
-rwxr-xr-x | imports/codemirror/mode/properties/index.html | 4 | ||||
-rwxr-xr-x | imports/codemirror/mode/properties/properties.css | 3 | ||||
-rwxr-xr-x | imports/codemirror/mode/properties/properties.js | 28 |
3 files changed, 19 insertions, 16 deletions
diff --git a/imports/codemirror/mode/properties/index.html b/imports/codemirror/mode/properties/index.html index 3df6a3ae..4f0c269c 100755 --- a/imports/codemirror/mode/properties/index.html +++ b/imports/codemirror/mode/properties/index.html | |||
@@ -5,7 +5,6 @@ | |||
5 | <link rel="stylesheet" href="../../lib/codemirror.css"> | 5 | <link rel="stylesheet" href="../../lib/codemirror.css"> |
6 | <script src="../../lib/codemirror.js"></script> | 6 | <script src="../../lib/codemirror.js"></script> |
7 | <script src="properties.js"></script> | 7 | <script src="properties.js"></script> |
8 | <link rel="stylesheet" href="properties.css"> | ||
9 | <style>.CodeMirror {border-top: 1px solid #ddd; border-bottom: 1px solid #ddd;}</style> | 8 | <style>.CodeMirror {border-top: 1px solid #ddd; border-bottom: 1px solid #ddd;}</style> |
10 | <link rel="stylesheet" href="../../doc/docs.css"> | 9 | <link rel="stylesheet" href="../../doc/docs.css"> |
11 | </head> | 10 | </head> |
@@ -34,7 +33,8 @@ spaces\ in\ keys=Not very common... | |||
34 | var editor = CodeMirror.fromTextArea(document.getElementById("code"), {}); | 33 | var editor = CodeMirror.fromTextArea(document.getElementById("code"), {}); |
35 | </script> | 34 | </script> |
36 | 35 | ||
37 | <p><strong>MIME types defined:</strong> <code>text/x-properties</code>.</p> | 36 | <p><strong>MIME types defined:</strong> <code>text/x-properties</code>, |
37 | <code>text/x-ini</code>.</p> | ||
38 | 38 | ||
39 | </body> | 39 | </body> |
40 | </html> | 40 | </html> |
diff --git a/imports/codemirror/mode/properties/properties.css b/imports/codemirror/mode/properties/properties.css deleted file mode 100755 index d975375c..00000000 --- a/imports/codemirror/mode/properties/properties.css +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | span.cm-key {color: #00c;} | ||
2 | span.cm-equals {color: #a11;} | ||
3 | span.cm-value {color: #170;} | ||
diff --git a/imports/codemirror/mode/properties/properties.js b/imports/codemirror/mode/properties/properties.js index 2529505b..d3a13c76 100755 --- a/imports/codemirror/mode/properties/properties.js +++ b/imports/codemirror/mode/properties/properties.js | |||
@@ -1,21 +1,23 @@ | |||
1 | CodeMirror.defineMode("properties", function() { | 1 | CodeMirror.defineMode("properties", function() { |
2 | return { | 2 | return { |
3 | token: function(stream, state) { | 3 | token: function(stream, state) { |
4 | var sol = stream.sol(); | 4 | var sol = stream.sol() || state.afterSection; |
5 | var eol = stream.eol(); | 5 | var eol = stream.eol(); |
6 | 6 | ||
7 | state.afterSection = false; | ||
8 | |||
7 | if (sol) { | 9 | if (sol) { |
8 | if (state.nextMultiline) { | 10 | if (state.nextMultiline) { |
9 | state.inMultiline = true; | 11 | state.inMultiline = true; |
10 | state.nextMultiline = false; | 12 | state.nextMultiline = false; |
11 | } else { | 13 | } else { |
12 | state.position = "key"; | 14 | state.position = "def"; |
13 | } | 15 | } |
14 | } | 16 | } |
15 | 17 | ||
16 | if (eol && ! state.nextMultiline) { | 18 | if (eol && ! state.nextMultiline) { |
17 | state.inMultiline = false; | 19 | state.inMultiline = false; |
18 | state.position = "key"; | 20 | state.position = "def"; |
19 | } | 21 | } |
20 | 22 | ||
21 | if (sol) { | 23 | if (sol) { |
@@ -24,16 +26,18 @@ CodeMirror.defineMode("properties", function() { | |||
24 | 26 | ||
25 | var ch = stream.next(); | 27 | var ch = stream.next(); |
26 | 28 | ||
27 | if (sol && (ch === "#" || ch === "!")) { | 29 | if (sol && (ch === "#" || ch === "!" || ch === ";")) { |
28 | state.position = "comment"; | 30 | state.position = "comment"; |
29 | stream.skipToEnd(); | 31 | stream.skipToEnd(); |
30 | return "comment"; | 32 | return "comment"; |
31 | 33 | } else if (sol && ch === "[") { | |
34 | state.afterSection = true; | ||
35 | stream.skipTo("]"); stream.eat("]"); | ||
36 | return "header"; | ||
32 | } else if (ch === "=" || ch === ":") { | 37 | } else if (ch === "=" || ch === ":") { |
33 | state.position = "value"; | 38 | state.position = "quote"; |
34 | return "equals"; | 39 | return null; |
35 | 40 | } else if (ch === "\\" && state.position === "quote") { | |
36 | } else if (ch === "\\" && state.position === "value") { | ||
37 | if (stream.next() !== "u") { // u = Unicode sequence \u1234 | 41 | if (stream.next() !== "u") { // u = Unicode sequence \u1234 |
38 | // Multiline value | 42 | // Multiline value |
39 | state.nextMultiline = true; | 43 | state.nextMultiline = true; |
@@ -45,9 +49,10 @@ CodeMirror.defineMode("properties", function() { | |||
45 | 49 | ||
46 | startState: function() { | 50 | startState: function() { |
47 | return { | 51 | return { |
48 | position : "key", // Current position, "key", "value" or "comment" | 52 | position : "def", // Current position, "def", "quote" or "comment" |
49 | nextMultiline : false, // Is the next line multiline value | 53 | nextMultiline : false, // Is the next line multiline value |
50 | inMultiline : false // Is the current line a multiline value | 54 | inMultiline : false, // Is the current line a multiline value |
55 | afterSection : false // Did we just open a section | ||
51 | }; | 56 | }; |
52 | } | 57 | } |
53 | 58 | ||
@@ -55,3 +60,4 @@ CodeMirror.defineMode("properties", function() { | |||
55 | }); | 60 | }); |
56 | 61 | ||
57 | CodeMirror.defineMIME("text/x-properties", "properties"); | 62 | CodeMirror.defineMIME("text/x-properties", "properties"); |
63 | CodeMirror.defineMIME("text/x-ini", "properties"); | ||