aboutsummaryrefslogtreecommitdiff
path: root/imports/codemirror/mode/tiddlywiki
diff options
context:
space:
mode:
authorValerio Virgillito2012-07-17 11:28:39 -0700
committerValerio Virgillito2012-07-17 11:28:39 -0700
commit4f737b24c19ddc02d20f9783b8b080fc6ef11142 (patch)
tree212d164c0f83d80394e34f1df532ea0461ad328d /imports/codemirror/mode/tiddlywiki
parent5146f224258929415adf4a8022e492454b4e2476 (diff)
parent0e04fff0ea80fa5cbe96b8354db38bd334aea83a (diff)
downloadninja-4f737b24c19ddc02d20f9783b8b080fc6ef11142.tar.gz
Merge pull request #396 from ananyasen/codemirror2.3-upgrade
upgrade to codemirror 2.3
Diffstat (limited to 'imports/codemirror/mode/tiddlywiki')
-rw-r--r--imports/codemirror/mode/tiddlywiki/tiddlywiki.css35
-rw-r--r--imports/codemirror/mode/tiddlywiki/tiddlywiki.js28
2 files changed, 28 insertions, 35 deletions
diff --git a/imports/codemirror/mode/tiddlywiki/tiddlywiki.css b/imports/codemirror/mode/tiddlywiki/tiddlywiki.css
index dba05c0f..9a69b639 100644
--- a/imports/codemirror/mode/tiddlywiki/tiddlywiki.css
+++ b/imports/codemirror/mode/tiddlywiki/tiddlywiki.css
@@ -1,21 +1,14 @@
1.cm-s-default span.cm-header {color: blue; font-weight:bold;} 1span.cm-underlined {
2.cm-s-default span.cm-code {color: #a50;} 2 text-decoration: underline;
3.cm-s-default span.cm-code-inline {color: #660;} 3}
4 4span.cm-strikethrough {
5.cm-s-default span.cm-quote {color: #555;} 5 text-decoration: line-through;
6.cm-s-default span.cm-list {color: #c60;} 6}
7.cm-s-default span.cm-hr {color: #999;} 7span.cm-brace {
8.cm-s-default span.cm-em {font-style: italic;} 8 color: #170;
9.cm-s-default span.cm-strong {font-weight: bold;} 9 font-weight: bold;
10 10}
11.cm-s-default span.cm-link-external {color: blue;} 11span.cm-table {
12.cm-s-default span.cm-brace {color: #170; font-weight: bold;} 12 color: blue;
13.cm-s-default span.cm-macro {color: #9E3825;} 13 font-weight: bold;
14.cm-s-default span.cm-table {color: blue; font-weight: bold;} 14}
15.cm-s-default span.cm-warning {color: red; font-weight: bold;}
16
17.cm-s-default span.cm-underlined {text-decoration: underline;}
18.cm-s-default span.cm-line-through {text-decoration: line-through;}
19
20.cm-s-default span.cm-comment {color: #666;}
21
diff --git a/imports/codemirror/mode/tiddlywiki/tiddlywiki.js b/imports/codemirror/mode/tiddlywiki/tiddlywiki.js
index 1d26967e..74fcd496 100644
--- a/imports/codemirror/mode/tiddlywiki/tiddlywiki.js
+++ b/imports/codemirror/mode/tiddlywiki/tiddlywiki.js
@@ -107,10 +107,10 @@ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) {
107 return ret('quote', 'quote'); 107 return ret('quote', 'quote');
108 } 108 }
109 if (stream.match(reWikiCommentStart) || stream.match(reWikiCommentStop)) { 109 if (stream.match(reWikiCommentStart) || stream.match(reWikiCommentStop)) {
110 return ret('code', 'code'); 110 return ret('code', 'comment');
111 } 111 }
112 if (stream.match(reJsCodeStart) || stream.match(reJsCodeStop) || stream.match(reXmlCodeStart) || stream.match(reXmlCodeStop)) { 112 if (stream.match(reJsCodeStart) || stream.match(reJsCodeStop) || stream.match(reXmlCodeStart) || stream.match(reXmlCodeStop)) {
113 return ret('code', 'code'); 113 return ret('code', 'comment');
114 } 114 }
115 if (stream.match(reHR)) { 115 if (stream.match(reHR)) {
116 return ret('hr', 'hr'); 116 return ret('hr', 'hr');
@@ -125,26 +125,26 @@ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) {
125 } 125 }
126 if (ch == "*") { // tw list 126 if (ch == "*") { // tw list
127 stream.eatWhile('*'); 127 stream.eatWhile('*');
128 return ret("list", "list"); 128 return ret("list", "comment");
129 } 129 }
130 if (ch == "#") { // tw numbered list 130 if (ch == "#") { // tw numbered list
131 stream.eatWhile('#'); 131 stream.eatWhile('#');
132 return ret("list", "list"); 132 return ret("list", "comment");
133 } 133 }
134 if (ch == ";") { // definition list, term 134 if (ch == ";") { // definition list, term
135 stream.eatWhile(';'); 135 stream.eatWhile(';');
136 return ret("list", "list"); 136 return ret("list", "comment");
137 } 137 }
138 if (ch == ":") { // definition list, description 138 if (ch == ":") { // definition list, description
139 stream.eatWhile(':'); 139 stream.eatWhile(':');
140 return ret("list", "list"); 140 return ret("list", "comment");
141 } 141 }
142 if (ch == ">") { // single line quote 142 if (ch == ">") { // single line quote
143 stream.eatWhile(">"); 143 stream.eatWhile(">");
144 return ret("quote", "quote"); 144 return ret("quote", "quote");
145 } 145 }
146 if (ch == '|') { 146 if (ch == '|') {
147 return ret('table', 'table'); 147 return ret('table', 'header');
148 } 148 }
149 } 149 }
150 150
@@ -155,7 +155,7 @@ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) {
155 // rudimentary html:// file:// link matching. TW knows much more ... 155 // rudimentary html:// file:// link matching. TW knows much more ...
156 if (/[hf]/i.test(ch)) { 156 if (/[hf]/i.test(ch)) {
157 if (/[ti]/i.test(stream.peek()) && stream.match(/\b(ttps?|tp|ile):\/\/[\-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i)) { 157 if (/[ti]/i.test(stream.peek()) && stream.match(/\b(ttps?|tp|ile):\/\/[\-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i)) {
158 return ret("link-external", "link-external"); 158 return ret("link", "link");
159 } 159 }
160 } 160 }
161 // just a little string indicator, don't want to have the whole string covered 161 // just a little string indicator, don't want to have the whole string covered
@@ -173,7 +173,7 @@ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) {
173 } 173 }
174 if (ch == "@") { // check for space link. TODO fix @@...@@ highlighting 174 if (ch == "@") { // check for space link. TODO fix @@...@@ highlighting
175 stream.eatWhile(isSpaceName); 175 stream.eatWhile(isSpaceName);
176 return ret("link-external", "link-external"); 176 return ret("link", "link");
177 } 177 }
178 if (/\d/.test(ch)) { // numbers 178 if (/\d/.test(ch)) { // numbers
179 stream.eatWhile(/\d/); 179 stream.eatWhile(/\d/);
@@ -266,21 +266,21 @@ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) {
266 var ch, sb = state.block; 266 var ch, sb = state.block;
267 267
268 if (sb && stream.current()) { 268 if (sb && stream.current()) {
269 return ret("code", "code"); 269 return ret("code", "comment");
270 } 270 }
271 271
272 if (!sb && stream.match(reUntilCodeStop)) { 272 if (!sb && stream.match(reUntilCodeStop)) {
273 state.tokenize = jsTokenBase; 273 state.tokenize = jsTokenBase;
274 return ret("code", "code-inline"); 274 return ret("code", "comment");
275 } 275 }
276 276
277 if (sb && stream.sol() && stream.match(reCodeBlockStop)) { 277 if (sb && stream.sol() && stream.match(reCodeBlockStop)) {
278 state.tokenize = jsTokenBase; 278 state.tokenize = jsTokenBase;
279 return ret("code", "code"); 279 return ret("code", "comment");
280 } 280 }
281 281
282 ch = stream.next(); 282 ch = stream.next();
283 return (sb) ? ret("code", "code") : ret("code", "code-inline"); 283 return (sb) ? ret("code", "comment") : ret("code", "comment");
284 } 284 }
285 285
286 // tw em / italic 286 // tw em / italic
@@ -324,7 +324,7 @@ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) {
324 } 324 }
325 maybeEnd = (ch == "-"); 325 maybeEnd = (ch == "-");
326 } 326 }
327 return ret("text", "line-through"); 327 return ret("text", "strikethrough");
328 } 328 }
329 329
330 // macro 330 // macro