diff options
author | Jose Antonio Marquez | 2012-05-04 14:00:54 -0700 |
---|---|---|
committer | Jose Antonio Marquez | 2012-05-04 14:00:54 -0700 |
commit | 9c0bda09a502472768f6dd5090a882d11be58d23 (patch) | |
tree | 28eb75165553daa979be3bc9223d35d875a008dc /imports/codemirror/mode/stex/stex.js | |
parent | 2456f0d60f642016135aa0f96126cb3249343757 (diff) | |
parent | fec9ccee11ea21ffc95edce6e89d0d302b63e3d8 (diff) | |
download | ninja-9c0bda09a502472768f6dd5090a882d11be58d23.tar.gz |
Merge branch 'refs/heads/Ninja-Internal' into Document
Diffstat (limited to 'imports/codemirror/mode/stex/stex.js')
-rw-r--r-- | imports/codemirror/mode/stex/stex.js | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/imports/codemirror/mode/stex/stex.js b/imports/codemirror/mode/stex/stex.js index bb47fb45..b89e619e 100644 --- a/imports/codemirror/mode/stex/stex.js +++ b/imports/codemirror/mode/stex/stex.js | |||
@@ -82,7 +82,7 @@ CodeMirror.defineMode("stex", function(cmCfg, modeCfg) | |||
82 | } | 82 | } |
83 | 83 | ||
84 | function normal(source, state) { | 84 | function normal(source, state) { |
85 | if (source.match(/^\\[a-z]+/)) { | 85 | if (source.match(/^\\[a-zA-Z@]+/)) { |
86 | var cmdName = source.current(); | 86 | var cmdName = source.current(); |
87 | cmdName = cmdName.substr(1, cmdName.length-1); | 87 | cmdName = cmdName.substr(1, cmdName.length-1); |
88 | var plug = plugins[cmdName]; | 88 | var plug = plugins[cmdName]; |
@@ -95,9 +95,22 @@ CodeMirror.defineMode("stex", function(cmCfg, modeCfg) | |||
95 | return plug.style; | 95 | return plug.style; |
96 | } | 96 | } |
97 | 97 | ||
98 | // escape characters | ||
99 | if (source.match(/^\\[$&%#{}_]/)) { | ||
100 | return "tag"; | ||
101 | } | ||
102 | |||
103 | // white space control characters | ||
104 | if (source.match(/^\\[,;!\/]/)) { | ||
105 | return "tag"; | ||
106 | } | ||
107 | |||
98 | var ch = source.next(); | 108 | var ch = source.next(); |
99 | if (ch == "%") { | 109 | if (ch == "%") { |
100 | setState(state, inCComment); | 110 | // special case: % at end of its own line; stay in same state |
111 | if (!source.eol()) { | ||
112 | setState(state, inCComment); | ||
113 | } | ||
101 | return "comment"; | 114 | return "comment"; |
102 | } | 115 | } |
103 | else if (ch=='}' || ch==']') { | 116 | else if (ch=='}' || ch==']') { |