/
todo.js
39 lines (31 loc) · 904 Bytes
/
todo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
CodeMirror.defineMode("todo", function() {
return {
token: function(stream) {
if (stream.match(/^(jan|fev|mar|apr|may|jun|jul|ago|oct|nov|dec)+\s(\d)+/i)) {
return "todo-date";
}
var ch = stream.next();
// CATEGORY
if (ch == "*") {
//stream.skipToEnd();
while ((next = stream.peek()) != "@" && !stream.eol()) stream.next();
return "todo-category";
}
if (ch == "+") {
//stream.skipToEnd();
while ((next = stream.peek()) != "@" && !stream.eol()) stream.next();
return "todo-plus";
}
if (ch == "!") {
//stream.skipToEnd();
while ((next = stream.peek()) != "@" && !stream.eol()) stream.next();
return "todo-urgent";
}
if (ch == "@") {
while ((next = stream.next()) != " " && !stream.eol());
return "todo-people";
}
}
};
});
CodeMirror.defineMIME("text/x-todo", "todo");