-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathToDone.jinja2.YAML-tmLanguage
176 lines (164 loc) · 4.82 KB
/
ToDone.jinja2.YAML-tmLanguage
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# [PackageDev] target_format: plist, ext: tmLanguage
{#
This is a Jinja2 template that generates a YAML file that is converted
to a tmLanguage file.
#}
# {% set num_levels = 5 %} {# variable for Jinja2 #}
---
name: ToDone
fileTypes: [todo, todone]
scopeName: text.todone
uuid: 93118f22-fcc3-4007-9de2-74fcbb17f143
patterns:
- include: '#everything'
#######################################
repository:
everything:
patterns:
- include: '#complete'
- include: '#ignore'
- include: '#task-class'
- include: '#lvl-disaster'
- include: '#lvl-1'
- include: '#lvl-2'
- include: '#lvl-3'
- include: '#lvl-4'
- include: '#lvl-5'
- include: '#note'
note:
name: storage.task-note.todone
begin: (?=.)
end: $
patterns:
- match: |
((?!///)[^`])+
- include: '#note-em'
- include: '#raw-note'
note-em:
name: storage.task-note.em.todone
begin: '`'
beginCaptures:
'0': {name: punctuation.definition.note.em.begin.todone}
end: '`'
endCaptures:
'0': {name: punctuation.definition.note.em.end.todone}
patterns:
- match: \\`
raw-note:
name: storage.task-note.raw.todone
begin: ///
beginCaptures:
'0': {name: punctuation.definition.note.raw.begin.todone}
end: ///
endCaptures:
'0': {name: punctuation.definition.note.raw.end.todone}
patterns:
- include: '#note-em'
- match: |
((?!///)[^`])+
task-over-raw-note:
begin: ///
end: ///
patterns:
- begin: '`'
end: '`'
patterns:
- match: \\`
complete:
name: storage.type.task.completed.todone
begin: ^(\s*)(\+!?)(\-+)?
beginCaptures:
'2': {name: keyword.operator.completed.todone}
'3': {name: keyword.operator.completed.secondary.todone}
end: ^(?!\1)|^\s*$|^(?=\1[^\s])
patterns:
- name: keyword.operator.completed.secondary.todone
match: ^\s+(\+)?(!?\-+)
- include: '#ignore'
- include: '#task-over-raw-note'
# had something here to consume raw notes:
# <dict>
# <key>begin</key>
# <string>~</string>
# <key>end</key>
# <string>~</string>
# </dict>
ignore:
name: storage.type.task.ignore.todone
begin: |
(?x)
^
(\s*)
(\.)(\+?!?\-+[12345]?)
\s*
(?:\(
([^\)]+)
\))?
beginCaptures:
'2': {name: keyword.operator.ignore.todone}
'3': {name: keyword.operator.ignore.secondary.todone}
'4': {name: keyword.operator.ignore.desc.todone}
end: ^(?!\1)|^\s*$|^(?=\1[^\s])
patterns:
- name: keyword.operator.task.todone
match: ^\s+\.?\+?\s*!?\s*\-+
# capture for second name bc comma breaks syntax highlight
captures:
'0': {name: keyword.operator.ignore.secondary.todone}
- include: '#task-over-raw-note'
# had something here to consume raw notes:
# <dict>
# <key>begin</key>
# <string>~</string>
# <key>end</key>
# <string>~</string>
# </dict>
task-class:
patterns:
- name: entity.name.class.todone
begin: \/\*
beginCaptures:
'0': {name: punctuation.definition.class-block.todone}
end: \*\/
endCaptures:
'0': {name: punctuation.definition.class-block.todone}
- name: entity.name.class.todone
match: ^[^\s\.\-+!].*$
lvl-disaster:
name: meta.condition.disaster.todone
begin: |
(?x)
(\s*)
(!)
(?:
{% for i in range(1, num_levels+1) -%}
(\-{{ "{" ~ i ~ "}" }}|\-({{i}}))\s+((?:://|/(?!//)|[^:\n/])*:?) {{ "|" if not loop.last }}
{% endfor %}
)
beginCaptures:
'0': {name: symbol.definition.task-heading.todone}
'2': {name: punctuation.definition.disaster.begin.todone}
{% for i in range(num_levels) -%}
'{{ 3 * i + 3 }}': {name: keyword.operator.task.lvl{{ i + 1 }}.todone}
'{{ 3 * i + 4 }}': {name: keyword.operator.task.numeral.lvl{{ i + 1 }}.todone}
'{{ 3 * i + 5 }}': {name: entity.name.task.lvl{{ i + 1 }}.todone}
{% endfor %}
end: ^(?!\1\s)|^(?=\s*\n)|^(?=\1[^\s])
endCaptures:
'0': {name: punctuation.definition.class-block.todone}
patterns:
- include: '#everything'
{% for i in range(1, num_levels+1) %}
lvl-{{ i }}:
name: storage.type.task.todone
begin: (\s*)(\-{{ "{" ~ i ~ "}" }}|\-({{ i }}))\s+((?:://|/(?!//)|[^:\n/])*)
beginCaptures:
'0': {name: symbol.definition.task-heading.todone}
'2': {name: keyword.operator.task.lvl{{ i }}.todone}
'3': {name: keyword.operator.task.numeral.lvl{{ i }}.todone}
'4': {name: entity.name.task.lvl{{ i }}.todone}
end: ^(?!\1)|^(?=\s*\n)|^(?=\1[^\s])
patterns:
- include: '#everything'
{% endfor %}
...