Changeset View
Changeset View
Standalone View
Standalone View
data/syntax/asciidoc.xml
- This file was added.
1 | <?xml version="1.0" encoding="UTF-8"?> | ||||
---|---|---|---|---|---|
2 | <!DOCTYPE language SYSTEM "language.dtd" [ | ||||
3 | <!-- alphabetic --> | ||||
4 | <!ENTITY alp "a-zA-Z"> | ||||
5 | <!-- alphanumeric --> | ||||
6 | <!ENTITY aln "&alp;0-9"> | ||||
7 | <!ENTITY id "\w[\w-]+"> | ||||
8 | <!-- percent symbol, needs to be encoded inside an entity definition --> | ||||
9 | <!ENTITY perc "%"> | ||||
10 | | ||||
11 | <!ENTITY admonition_names "CAUTION|IMPORTANT|NOTE|TIP|WARNING"> | ||||
12 | | ||||
13 | <!-- regular expression parts to identify anchors --> | ||||
14 | <!ENTITY anchor_mid "&id;(?:,.+?)?"> | ||||
15 | <!ENTITY anchor_phrase "#\S(?:.*?\S)?#"> | ||||
16 | | ||||
17 | <!-- block delimiters --> | ||||
18 | <!ENTITY block_dels_comment "/{4,}"> | ||||
19 | <!ENTITY block_dels_normal "={4,}|_{4,}|\*{4,}|-{2}|"{2}"> | ||||
20 | <!ENTITY block_dels_pass "\+{4,}"> | ||||
21 | <!ENTITY block_dels_verbatim "`{3}|-{4,}|\.{4,}"> | ||||
22 | <!-- postfix/trailing part of block name --> | ||||
23 | <!ENTITY block_name_post "(?:[#&perc;].+)?\s*(,.*)?\]\s*$"> | ||||
24 | <!-- block end delimiter, dynamic matching: "^%1\s*$" --> | ||||
25 | <!ENTITY block_end_del "^&perc;1\s*$"> | ||||
26 | | ||||
27 | <!-- unicode character reference, decimal and hexadecimal --> | ||||
28 | <!ENTITY char_ref "&#(?:\d{2,4}|x[\da-fA-F]{2,4});"> | ||||
29 | | ||||
30 | <!-- email - inline --> | ||||
31 | <!ENTITY email "\w[\w.&perc;+-]*@[&aln;][&aln;.-]*\.[&alp;]{2,4}\b"> | ||||
32 | | ||||
33 | <!-- link macro and mailto: --> | ||||
34 | <!ENTITY link_mailto "(?:link|mailto):[^:\s\[][^\s\[]*\[(?:\]|.*?[^\\]\])"> | ||||
35 | | ||||
36 | <!-- parts to build regular expressions to identify quoted (formatted) text | ||||
37 | E.g. emphasized, marked, strong. --> | ||||
38 | <!-- prefix/leading part --> | ||||
39 | <!ENTITY quoted_pre "(?<=^|[^\w;:}])"> | ||||
40 | <!ENTITY quoted_pre_pass "(?<=^|\W)"> | ||||
41 | <!-- central part --> | ||||
42 | <!ENTITY quoted "\S(?:.*?\S)??"> | ||||
43 | <!-- postfix/trailing part --> | ||||
44 | <!ENTITY quoted_post "(?=\W|$)"> | ||||
45 | ]> | ||||
46 | <language author="Andreas Gratzer" extensions="*.ad;*.adoc;*.asciidoc" kateversion="5.0" mimetype="text/asciidoc" name="AsciiDoc" license="MIT" section="Markup" version="1"> | ||||
47 | <highlighting> | ||||
48 | <list name="macro"> | ||||
49 | <item>anchor</item> | ||||
50 | <item>btn</item> | ||||
51 | <item>footnote</item> | ||||
52 | <item>footnoteref</item> | ||||
53 | <item>icon</item> | ||||
54 | <item>image</item> | ||||
55 | <item>indexterm</item> | ||||
56 | <item>indexterm2</item> | ||||
57 | <item>kbd</item> | ||||
58 | <item>menu</item> | ||||
59 | <item>pass</item> | ||||
60 | <item>toc</item> | ||||
61 | <item>xref</item> | ||||
62 | </list> | ||||
63 | | ||||
64 | <contexts> | ||||
65 | <context name="start" attribute="Normal" lineEndContext="#stay"> | ||||
66 | <!-- main title, first level 0 section title --> | ||||
67 | <RegExpr String="^(?:=|#)\s+(?=\S)" attribute="Main Title" context="main title"/> | ||||
68 | <IncludeRules context="section"/> | ||||
69 | </context> | ||||
70 | | ||||
71 | <!-- attribute value definition, may span multiple lines --> | ||||
72 | <context name="attribute value" attribute="Normal" lineEndContext="#stay" lineEmptyContext="#pop"> | ||||
73 | <!-- line with continuation --> | ||||
74 | <RegExpr String=".*?(?=\s+(\+\s+)?\\\s*$)" attribute="Attribute Value" context="continuation"/> | ||||
75 | <!-- line without continuation, terminates value definition --> | ||||
76 | <RegExpr String=".*" attribute="Attribute Value" context="#pop"/> | ||||
77 | </context> | ||||
78 | <!-- inline attribute value definition --> | ||||
79 | <context name="attribute value inline" attribute="Attribute Value" lineEndContext="#stay"> | ||||
80 | <!-- the leading `:` is part of the definition syntax and should not be highlighted as value --> | ||||
81 | <DetectChar char=":" attribute="Attribute" context="attribute value inline L2"/> | ||||
82 | <DetectChar char="}" attribute="Attribute" context="#pop"/> | ||||
83 | </context> | ||||
84 | <context name="attribute value inline L2" attribute="Attribute Value" lineEndContext="#stay"> | ||||
85 | <DetectChar char="}" attribute="Attribute" context="#pop#pop"/> | ||||
86 | </context> | ||||
87 | | ||||
88 | <!-- backlash, may function as an escape --> | ||||
89 | <context name="backlash" attribute="Normal" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop"> | ||||
90 | <!-- anchor, consuming leading char will make anchor matches fail --> | ||||
91 | <DetectChar char="[" attribute="Normal" context="#pop"/> | ||||
92 | <!-- cross reference --> | ||||
93 | <DetectChar char="<" attribute="Normal" context="#pop"/> | ||||
94 | <!-- email - inline, needs to be ordered after mailto: --> | ||||
95 | <RegExpr String="&email;" attribute="Normal" context="#pop"/> | ||||
96 | <!-- attribute usage | ||||
97 | formatted/quoted text | ||||
98 | replacement of apostrophe | ||||
99 | table separator (default) | ||||
100 | --> | ||||
101 | <AnyChar String="_#`+*~^'|{" attribute="Normal" context="#pop"/> | ||||
102 | <!-- indexterm, consuming leading char will make matches fail --> | ||||
103 | <DetectChar char="(" attribute="Normal" context="#pop"/> | ||||
104 | <!-- link and mailto macros, note that ftp, irc, http(s) don't match with leading `\` anyway --> | ||||
105 | <RegExpr String="&link_mailto;" attribute="Normal" context="#pop"/> | ||||
106 | <!-- macro --> | ||||
107 | <keyword String="macro" attribute="Normal" context="#pop"/> | ||||
108 | <!-- replacement (besides apostrophe --> | ||||
109 | <StringDetect String="(C)" attribute="Normal" context="#pop"/> | ||||
110 | <StringDetect String="(R)" attribute="Normal" context="#pop"/> | ||||
111 | <StringDetect String="(TM)" attribute="Normal" context="#pop"/> | ||||
112 | <Detect2Chars char="-" char1="-" attribute="Normal" context="#pop"/> | ||||
113 | <StringDetect String="..." attribute="Normal" context="#pop"/> | ||||
114 | <Detect2Chars char="<" char1="-" attribute="Normal" context="#pop"/> | ||||
115 | <Detect2Chars char="-" char1=">" attribute="Normal" context="#pop"/> | ||||
116 | <Detect2Chars char="<" char1="=" attribute="Normal" context="#pop"/> | ||||
117 | <Detect2Chars char="=" char1=">" attribute="Normal" context="#pop"/> | ||||
118 | <RegExpr String="&char_ref;" attribute="Normal" context="#pop"/> | ||||
119 | </context> | ||||
120 | | ||||
121 | <context name="block title" attribute="Block Title" lineEndContext="#pop"> | ||||
122 | <IncludeRules context="R title"/> | ||||
123 | </context> | ||||
124 | | ||||
125 | <context name="comment" attribute="Comment" lineEndContext="#stay" lineEmptyContext="#pop"> | ||||
126 | <RegExpr String="^(&block_dels_comment;)\s*$" attribute="Comment" context="#pop!comment delimited" beginRegion="comment"/> | ||||
127 | <IncludeRules context="R anchor"/> | ||||
128 | <IncludeRules context="R block title"/> | ||||
129 | <IncludeRules context="##Alerts" /> | ||||
130 | </context> | ||||
131 | <context name="comment delimited" attribute="Comment" lineEndContext="#stay"> | ||||
132 | <RegExpr String="&block_end_del;" dynamic="true" attribute="Comment" context="#pop" endRegion="comment"/> | ||||
133 | <IncludeRules context="##Alerts" /> | ||||
134 | </context> | ||||
135 | <context name="comment single-line" attribute="Comment" lineEndContext="#pop"> | ||||
136 | <IncludeRules context="##Alerts" /> | ||||
137 | </context> | ||||
138 | | ||||
139 | <!-- continuation, both for normal text and attribute value definition | ||||
140 | The allowed pattern must already by validated. | ||||
141 | Here only the possible characters are highlighted. --> | ||||
142 | <context name="continuation" attribute="Normal" lineEndContext="#pop"> | ||||
143 | <AnyChar String="+\" attribute="Control"/> | ||||
144 | </context> | ||||
145 | | ||||
146 | <context name="main title" attribute="Main Title" lineEndContext="#pop!section"> | ||||
147 | <IncludeRules context="R title"/> | ||||
148 | </context> | ||||
149 | | ||||
150 | <context name="normal" attribute="Normal" lineEndContext="#stay" lineEmptyContext="#pop"> | ||||
151 | <RegExpr String="^(-{2}|&block_dels_normal;)\s*$" attribute="Delimiter" context="#pop!normal delimited" beginRegion="block"/> | ||||
152 | <IncludeRules context="R block title"/> | ||||
153 | <!-- shared rules includes anchor rules, so we do not need to include that separately --> | ||||
154 | <IncludeRules context="R shared"/> | ||||
155 | </context> | ||||
156 | <context name="normal delimited" attribute="Normal" lineEndContext="#stay"> | ||||
157 | <RegExpr String="&block_end_del;" dynamic="true" attribute="Delimiter" context="#pop" endRegion="block"/> | ||||
158 | <IncludeRules context="R admonition"/> | ||||
159 | <IncludeRules context="R block"/> | ||||
160 | <!-- shared rules includes anchor rules, so we do not need to include that separately --> | ||||
161 | <IncludeRules context="R shared"/> | ||||
162 | </context> | ||||
163 | | ||||
164 | <context name="passthrough" attribute="Passthrough" lineEndContext="#stay" lineEmptyContext="#pop"> | ||||
165 | <RegExpr String="^(&block_dels_pass;)\s*$" attribute="Delimiter" context="#pop!passthrough delimited" beginRegion="block"/> | ||||
166 | <IncludeRules context="R anchor"/> | ||||
167 | <IncludeRules context="R block title"/> | ||||
168 | </context> | ||||
169 | <context name="passthrough delimited" attribute="Passthrough" lineEndContext="#stay"> | ||||
170 | <RegExpr String="&block_end_del;" dynamic="true" attribute="Delimiter" context="#pop" endRegion="block"/> | ||||
171 | </context> | ||||
172 | | ||||
173 | <context name="section" attribute="Normal" lineEndContext="#stay"> | ||||
174 | <!-- callout as being used below a source code block --> | ||||
175 | <RegExpr String="^<(?:\.|\d+)>(?=\s+\S)" attribute="Callout"/> | ||||
176 | <!-- section title --> | ||||
177 | <RegExpr String="^(?:={1,6}|#{1,6})\s+(?=\S)" attribute="Section Title" context="section title"/> | ||||
178 | <IncludeRules context="R admonition"/> | ||||
179 | <IncludeRules context="R block"/> | ||||
180 | <IncludeRules context="R shared"/> | ||||
181 | <!-- literal paragraph started by a line with leading spaces | ||||
182 | This must be ordered after lists, as list items may be indented --> | ||||
183 | <RegExpr String="^\s+\S" attribute="Verbatim" context="verbatim paragraph"/> | ||||
184 | </context> | ||||
185 | | ||||
186 | <context name="section title" attribute="Section Title" lineEndContext="#pop"> | ||||
187 | <IncludeRules context="R title"/> | ||||
188 | </context> | ||||
189 | | ||||
190 | <context name="table" attribute="Normal" lineEndContext="#stay"> | ||||
191 | <RegExpr String="&block_end_del;" dynamic="true" attribute="Delimiter" context="#pop" endRegion="block"/> | ||||
192 | <!-- `|` with prefix for alignment, style etc. --> | ||||
193 | <RegExpr String="(?<=^|\s)(?:(\d*\.)?\d+\+|\d+\*)?(?:[<>^]?\.?[<>^])?[adehlmsv]?\|" attribute="Delimiter"/> | ||||
194 | <!-- simple `|` without alignment, style etc. --> | ||||
195 | <DetectChar char="|" attribute="Delimiter"/> | ||||
196 | <IncludeRules context="R shared"/> | ||||
197 | </context> | ||||
198 | | ||||
199 | <context name="verbatim" attribute="Verbatim" lineEndContext="#stay"> | ||||
200 | <RegExpr String="^(-{2}|&block_dels_verbatim;)\s*$" attribute="Delimiter" context="#pop!verbatim delimited" beginRegion="block"/> | ||||
201 | <IncludeRules context="R anchor"/> | ||||
202 | <IncludeRules context="R block title"/> | ||||
203 | <IncludeRules context="R comment"/> | ||||
204 | <RegExpr String="^." attribute="Verbatim" context="#pop!verbatim paragraph"/> | ||||
205 | </context> | ||||
206 | <context name="verbatim delimited" attribute="Verbatim" lineEndContext="#stay"> | ||||
207 | <RegExpr String="&block_end_del;" dynamic="true" attribute="Delimiter" context="#pop" endRegion="block"/> | ||||
208 | <IncludeRules context="R include"/> | ||||
209 | </context> | ||||
210 | <context name="verbatim paragraph" attribute="Verbatim" lineEndContext="#stay" lineEmptyContext="#pop"/> | ||||
211 | | ||||
212 | <!-- contexts to be used for IncludeRules only --> | ||||
213 | | ||||
214 | <context name="R admonition" attribute="Normal" lineEndContext="#stay"> | ||||
215 | <!-- admonition - simple form, block form is part of block rules --> | ||||
216 | <RegExpr String="^(?:&admonition_names;):(?=\s+\S)" attribute="Preprocessor" context="normal"/> | ||||
217 | </context> | ||||
218 | | ||||
219 | <context name="R anchor" attribute="Normal" lineEndContext="#stay"> | ||||
220 | <!-- bibliographic anchor --> | ||||
221 | <RegExpr String="\[{3}&anchor_mid;\]{3}" attribute="Anchor"/> | ||||
222 | <!-- normal form --> | ||||
223 | <RegExpr String="\[{2}&anchor_mid;\]{2}" attribute="Anchor"/> | ||||
224 | <!-- shorthand form at line start --> | ||||
225 | <RegExpr String="^\[#&anchor_mid;\](&anchor_phrase;|\s*$)" attribute="Anchor"/> | ||||
226 | <!-- shorthand form inline --> | ||||
227 | <RegExpr String="(?<=\S\s)\s*\[\s*#&anchor_mid;\s*\]&anchor_phrase;" attribute="Anchor"/> | ||||
228 | </context> | ||||
229 | | ||||
230 | <context name="R attribute" attribute="Normal" lineEndContext="#stay"> | ||||
231 | <!-- attribute definition without value / unset attribute --> | ||||
232 | <RegExpr String="^:!?&id;!?:$" attribute="Attribute"/> | ||||
233 | <!-- attribute definition with value --> | ||||
234 | <RegExpr String="^:!?&id;!?:\s(?=\S)" attribute="Attribute" context="attribute value"/> | ||||
235 | <!-- attribute inline definition --> | ||||
236 | <RegExpr String="\{set:&id;(?=(:.*)?\})" minimal="true" attribute="Attribute" context="attribute value inline"/> | ||||
237 | <IncludeRules context="R attribute usage"/> | ||||
238 | </context> | ||||
239 | | ||||
240 | <context name="R attribute usage" attribute="Normal" lineEndContext="#stay"> | ||||
241 | <RegExpr String="\{&id;\}" attribute="Attribute"/> | ||||
242 | </context> | ||||
243 | | ||||
244 | <context name="R block" attribute="Normal" lineEndContext="#stay"> | ||||
245 | <IncludeRules context="R block title"/> | ||||
246 | | ||||
247 | <!-- name matching --> | ||||
248 | <RegExpr String="^\[(?:&admonition_names;)&block_name_post;" attribute="Preprocessor" context="normal"/> | ||||
249 | <RegExpr String="^\[(?:example|quote|sidebar|verse)&block_name_post;" attribute="Preprocessor" context="normal"/> | ||||
250 | <RegExpr String="^\[(?:pass|stem)&block_name_post;" attribute="Preprocessor" context="passthrough"/> | ||||
251 | <RegExpr String="^\[(?:listing|literal|source)&block_name_post;" attribute="Preprocessor" context="verbatim"/> | ||||
252 | | ||||
253 | <!-- delimiter matching --> | ||||
254 | <RegExpr String="^(&block_dels_normal;)\s*$" attribute="Delimiter" context="normal delimited" beginRegion="block"/> | ||||
255 | <RegExpr String="^(&block_dels_pass;)\s*$" attribute="Delimiter" context="passthrough delimited" beginRegion="block"/> | ||||
256 | <RegExpr String="^(\|={3,})\s*$" attribute="Delimiter" context="table" beginRegion="block"/> | ||||
257 | <RegExpr String="^(&block_dels_verbatim;)\s*$" attribute="Delimiter" context="verbatim delimited" beginRegion="block"/> | ||||
258 | </context> | ||||
259 | | ||||
260 | <context name="R block title" attribute="Normal" lineEndContext="#stay"> | ||||
261 | <!-- not more than 3 leading dots followed by a non-dot, otherwise it would conflict with the delimited literal block --> | ||||
262 | <RegExpr String="^\.{1,3}(?=[^\.\s])" attribute="Block Title" context="block title"/> | ||||
263 | </context> | ||||
264 | | ||||
265 | <context name="R comment" attribute="Normal" lineEndContext="#stay"> | ||||
266 | <!-- comment - multi-line, named block --> | ||||
267 | <RegExpr String="^\[comment&block_name_post;" attribute="Preprocessor" context="comment"/> | ||||
268 | <!-- comment - multi-line, delimited block --> | ||||
269 | <RegExpr String="^(&block_dels_comment;)\s*$" attribute="Comment" context="comment delimited" beginRegion="comment"/> | ||||
270 | <!-- comment - single line --> | ||||
271 | <RegExpr String="^/{2}([^/]|$)" attribute="Comment" context="comment single-line"/> | ||||
272 | </context> | ||||
273 | | ||||
274 | <context name="R formatted" attribute="Normal" lineEndContext="#stay"> | ||||
275 | <!-- custom style, e.g. [underline]#underlined text# --> | ||||
276 | <RegExpr String="(?<=^|\W)\[[^\]]+?\]((#|_|`|\*){1,2})"ed;\g1"ed_post;" attribute="Preprocessor"/> | ||||
277 | | ||||
278 | <!-- combined highlighting must be ordered before simple highlighting --> | ||||
279 | | ||||
280 | <!-- emphasized monospaced strong unconstrained - must be ordered before constrained --> | ||||
281 | <RegExpr String="`{2}\*_.*_\*`{2}" minimal="true" attribute="Emphasized Monospaced Strong"/> | ||||
282 | <!-- emphasized monospaced strong - constrained must be ordered after unconstrained --> | ||||
283 | <RegExpr String=""ed_pre;`\*_"ed;_\*`"ed_post;" attribute="Emphasized Monospaced Strong"/> | ||||
284 | | ||||
285 | <!-- emphasized strong unconstrained - must be ordered before constrained --> | ||||
286 | <RegExpr String="\*{2}_.*_\*{2}" minimal="true" attribute="Emphasized Strong"/> | ||||
287 | <!-- emphasized strong constrained - must be ordered after unconstrained --> | ||||
288 | <RegExpr String=""ed_pre;\*_"ed;_\*"ed_post;" attribute="Emphasized Strong"/> | ||||
289 | | ||||
290 | <!-- monospaced strong unconstrained - must be ordered before constrained --> | ||||
291 | <RegExpr String="`{2}\*.*\*`{2}" minimal="true" attribute="Monospaced Strong"/> | ||||
292 | <!-- monospaced strong constrained - must be ordered after unconstrained --> | ||||
293 | <RegExpr String=""ed_pre;`\*"ed;\*`"ed_post;" attribute="Monospaced Strong"/> | ||||
294 | | ||||
295 | <!-- emphasized monospaced unconstrained - must be ordered before constrained --> | ||||
296 | <RegExpr String="`{2}_.*_`{2}" minimal="true" attribute="Emphasized Monospaced"/> | ||||
297 | <!-- emphasized monospaced constrained - must be ordered after unconstrained --> | ||||
298 | <RegExpr String=""ed_pre;`_"ed;_`"ed_post;" attribute="Emphasized Monospaced"/> | ||||
299 | | ||||
300 | <!-- strong unconstrained - must be ordered before constrained --> | ||||
301 | <RegExpr String="\*{2}[^*].*\*{2}" minimal="true" attribute="Strong"/> | ||||
302 | <!-- strong constrained - must be ordered after unconstrained --> | ||||
303 | <RegExpr String=""ed_pre;\*"ed;\*"ed_post;" attribute="Strong"/> | ||||
304 | | ||||
305 | <!-- emphasized unconstrained - must be ordered before constrained --> | ||||
306 | <RegExpr String="_{2}[^_].*_{2}" minimal="true" attribute="Emphasized"/> | ||||
307 | <!-- emphasized constrained - must be ordered after unconstrained | ||||
308 | Can't use "ed_pre; as that excludes \w which excludes `_` too. --> | ||||
309 | <RegExpr String="(?<=^|[^&alp;;:}])_"ed;_"ed_post;" attribute="Emphasized"/> | ||||
310 | | ||||
311 | <IncludeRules context="R marked"/> | ||||
312 | <IncludeRules context="R monospaced"/> | ||||
313 | | ||||
314 | <!-- subscript --> | ||||
315 | <RegExpr String="~\S+~" minimal="true" attribute="Subscript"/> | ||||
316 | <!-- superscript --> | ||||
317 | <RegExpr String="\^\S+\^" minimal="true" attribute="Superscript"/> | ||||
318 | </context> | ||||
319 | | ||||
320 | <context name="R include" attribute="Normal" lineEndContext="#stay"> | ||||
321 | <RegExpr String="^include::.*\[.*?\](?=\s*$)" attribute="Preprocessor"/> | ||||
322 | </context> | ||||
323 | | ||||
324 | <context name="R macro" attribute="Normal" lineEndContext="#stay"> | ||||
325 | <RegExpr String="(?:anchor|xref):&id;\[.*?\]" attribute="Preprocessor"/> | ||||
326 | <RegExpr String="(?:btn|footnote(ref)?|kbd):\[.*?\]" attribute="Preprocessor"/> | ||||
327 | <RegExpr String="pass:\w*\[.*?\]" attribute="Preprocessor"/> | ||||
328 | <RegExpr String="(?:icon|image|menu):[^:].*?\[.*?\]" attribute="Preprocessor"/> | ||||
329 | <RegExpr String="toc::\[\]" attribute="Preprocessor"/> | ||||
330 | </context> | ||||
331 | | ||||
332 | <context name="R marked" attribute="Normal" lineEndContext="#stay"> | ||||
333 | <!-- marked unconstrained - must be ordered before constrained --> | ||||
334 | <RegExpr String="#{2}.+#{2}" minimal="true" attribute="Marked"/> | ||||
335 | <!-- marked constrained - must be ordered after unconstrained --> | ||||
336 | <RegExpr String=""ed_pre;#"ed;#"ed_post;" attribute="Marked"/> | ||||
337 | </context> | ||||
338 | | ||||
339 | <context name="R monospaced" attribute="Normal" lineEndContext="#stay"> | ||||
340 | <!-- monospaced unconstrained - must be ordered before constrained --> | ||||
341 | <RegExpr String="`{2}[^`].*`{2}" minimal="true" attribute="Monospaced"/> | ||||
342 | <!-- monospaced constrained - must be ordered after unconstrained --> | ||||
343 | <RegExpr String=""ed_pre;`"ed;`"ed_post;" attribute="Monospaced"/> | ||||
344 | </context> | ||||
345 | | ||||
346 | <!-- replacements --> | ||||
347 | <context name="R replacement" attribute="Normal" lineEndContext="#stay"> | ||||
348 | <!-- copyright --> | ||||
349 | <StringDetect String="(C)" attribute="Replacement"/> | ||||
350 | <!-- registered --> | ||||
351 | <StringDetect String="(R)" attribute="Replacement"/> | ||||
352 | <!-- trademark --> | ||||
353 | <StringDetect String="(TM)" attribute="Replacement"/> | ||||
354 | <!-- apostrophe, only when between alphabetic characters --> | ||||
355 | <RegExpr String="(?<=[&alp;])'(?=[&alp;])" attribute="Replacement"/> | ||||
356 | <!-- ellipses --> | ||||
357 | <StringDetect String="..." attribute="Replacement"/> | ||||
358 | <!-- mdash --> | ||||
359 | <Detect2Chars char="-" char1="-" attribute="Replacement"/> | ||||
360 | <!-- left single arrow --> | ||||
361 | <Detect2Chars char="<" char1="-" attribute="Replacement"/> | ||||
362 | <!-- right single arrow --> | ||||
363 | <Detect2Chars char="-" char1=">" attribute="Replacement"/> | ||||
364 | <!-- left double arrow --> | ||||
365 | <Detect2Chars char="<" char1="=" attribute="Replacement"/> | ||||
366 | <!-- right double arrow --> | ||||
367 | <Detect2Chars char="=" char1=">" attribute="Replacement"/> | ||||
368 | <!-- unicode character reference --> | ||||
369 | <RegExpr String="&char_ref;" attribute="Replacement"/> | ||||
370 | </context> | ||||
371 | | ||||
372 | <context name="R shared" attribute="Normal" lineEndContext="#stay"> | ||||
373 | <!-- the escaped forms must be ordered before the not escaped forms --> | ||||
374 | <DetectChar char="\" attribute="Normal" context="backlash"/> | ||||
375 | | ||||
376 | <!-- passthrough - inline, must be ordered before other rules | ||||
377 | The macro form pass: is part of "R macro" context --> | ||||
378 | <RegExpr String=""ed_pre_pass;(\+{1,3})"ed;\g1"ed_post;" attribute="Passthrough"/> | ||||
379 | | ||||
380 | <IncludeRules context="R anchor"/> | ||||
381 | <IncludeRules context="R attribute"/> | ||||
382 | <IncludeRules context="R comment"/> | ||||
383 | <IncludeRules context="R include"/> | ||||
384 | <IncludeRules context="R macro"/> | ||||
385 | | ||||
386 | <!-- counter and counter2 --> | ||||
387 | <RegExpr String="\{counter2?:\s*&id;\s*(?::\s*(\d+|[&alp;])\s*)?\}" minimal="true" attribute="Attribute"/> | ||||
388 | | ||||
389 | <!-- horizontal rules and page break --> | ||||
390 | <!-- to enable highlighting of the horizontal rules using "- - -" or "* * *", | ||||
391 | keep this before the checklist and unnumbered list definition --> | ||||
392 | <RegExpr String="^(?:'{3}|-{3}|\*{3}|- - -|\* \* \*|<{3})\s*$" attribute="Control"/> | ||||
393 | | ||||
394 | <!-- cross reference --> | ||||
395 | <RegExpr String="<<[^<\s].*?>>" attribute="Link"/> | ||||
396 | | ||||
397 | <!-- index term --> | ||||
398 | <RegExpr String="\({3}.+?\){3}" attribute="Preprocessor"/> | ||||
399 | <RegExpr String="\({2}.+?\){2}" attribute="Preprocessor"/> | ||||
400 | <RegExpr String="indexterm2?:\[.+?\]" attribute="Preprocessor"/> | ||||
401 | | ||||
402 | <!-- marker for description list --> | ||||
403 | <RegExpr String="^\s*\S.+::(?=\s|$)" attribute="List Marker"/> | ||||
404 | <!-- marker for numbered list --> | ||||
405 | <RegExpr String="^\s*(?:\.+|\d+\.)(?=\s+\S)" attribute="List Marker"/> | ||||
406 | <!-- marker for checklist and bulleted/unnumbered list | ||||
407 | To enable highlighting of the horizontal rules using "- - -" or "* * *", | ||||
408 | keep this after the horizontal rules definition --> | ||||
409 | <RegExpr String="^\s*(?:-|\*+)(?:\s+\[[*x ]\])?(?=\s+\S)" attribute="List Marker"/> | ||||
410 | | ||||
411 | <!-- media - block format --> | ||||
412 | <RegExpr String="^(?:audio|image|video)::.*\[.*?\](?=\s*$)" attribute="Preprocessor"/> | ||||
413 | | ||||
414 | <!-- links --> | ||||
415 | <RegExpr String="(?<=^|[\s\[\]();<>])(?:ftp|https?|irc)://[^\s\[]*(?:\[\]|\[.*[^\\]\]|(?=([\[\]]|[\.,;:]?(\s|$))))" minimal="true" attribute="Link"/> | ||||
416 | <RegExpr String="&link_mailto;" attribute="Link"/> | ||||
417 | <!-- email - inline, needs to be ordered after mailto: | ||||
418 | For some reason, Asciidoctor recognizes emails with leading : or / but does not render them as link --> | ||||
419 | <RegExpr String="[:/]&email;" attribute="Normal"/> | ||||
420 | <RegExpr String="&email;" attribute="Link"/> | ||||
421 | | ||||
422 | <!-- preprocessor --> | ||||
423 | <RegExpr String="^ifn?def::&id;(?:[,\+]&id;)*\[.*\]" minimal="true" attribute="Preprocessor"/> | ||||
424 | <RegExpr String="^ifeval::\[.*\]" minimal="true" attribute="Preprocessor"/> | ||||
425 | <RegExpr String="^endif::(?:&id;)?\[\]" attribute="Preprocessor"/> | ||||
426 | | ||||
427 | <!-- general meta data attribute list - must be ordered after other rules matching for lines of the form of [some content] --> | ||||
428 | <RegExpr String="^\[[^\s\[].*\](?=\s*$)" attribute="Preprocessor"/> | ||||
429 | | ||||
430 | <!-- continuation `+`, both at end of line and on a line on its own --> | ||||
431 | <RegExpr String="(?:^|\s)\s*\+\s*$" lookAhead="true" attribute="Normal" context="continuation"/> | ||||
432 | | ||||
433 | <!-- formatted/quoted must be ordered after unnumbered list --> | ||||
434 | <IncludeRules context="R formatted"/> | ||||
435 | <!-- replacements are done only if nothing else matched --> | ||||
436 | <IncludeRules context="R replacement"/> | ||||
437 | </context> | ||||
438 | | ||||
439 | <!-- common rules for main title, section title, block title --> | ||||
440 | <context name="R title" attribute="Normal" lineEndContext="#stay"> | ||||
441 | <!-- the escaped forms must be ordered before the not escaped forms --> | ||||
442 | <DetectChar char="\" attribute="Section Title" context="backlash"/> | ||||
443 | <IncludeRules context="R anchor"/> | ||||
444 | <IncludeRules context="R attribute usage"/> | ||||
445 | <IncludeRules context="R marked"/> | ||||
446 | <IncludeRules context="R monospaced"/> | ||||
447 | </context> | ||||
448 | </contexts> | ||||
449 | | ||||
450 | <itemDatas> | ||||
451 | <itemData name="Anchor" defStyleNum="dsFunction"/> | ||||
452 | <itemData name="Attribute" defStyleNum="dsVariable"/> | ||||
453 | <itemData name="Attribute Value" defStyleNum="dsVariable" italic="true"/> | ||||
454 | <itemData name="Block Title" defStyleNum="dsString" italic="true"/> | ||||
455 | <itemData name="Callout" defStyleNum="dsNormal" bold="true" underline="true"/> | ||||
456 | <itemData name="Comment" defStyleNum="dsComment"/> | ||||
457 | <itemData name="Control" defStyleNum="dsControlFlow" bold="true" underline="true"/> | ||||
458 | <itemData name="Delimiter" defStyleNum="dsPreprocessor" bold="true"/> | ||||
459 | <itemData name="Emphasized" defStyleNum="dsNormal" italic="true"/> | ||||
460 | <itemData name="Emphasized Monospaced" defStyleNum="dsDocumentation" italic="true"/> | ||||
461 | <itemData name="Emphasized Monospaced Strong" defStyleNum="dsDocumentation" bold="true" italic="true"/> | ||||
462 | <itemData name="Emphasized Strong" defStyleNum="dsNormal" bold="true" italic="true"/> | ||||
463 | <itemData name="Link" defStyleNum="dsVariable" underline="true"/> | ||||
464 | <itemData name="List Marker" defStyleNum="dsNormal" bold="true"/> | ||||
465 | <itemData name="Main Title" defStyleNum="dsNormal" bold="true"/> | ||||
466 | <itemData name="Marked" defStyleNum="dsFloat"/> | ||||
467 | <itemData name="Monospaced" defStyleNum="dsDocumentation"/> | ||||
468 | <itemData name="Monospaced Strong" defStyleNum="dsDocumentation" bold="true"/> | ||||
469 | <itemData name="Normal" defStyleNum="dsNormal"/> | ||||
470 | <itemData name="Passthrough" defStyleNum="dsSpecialString"/> | ||||
471 | <itemData name="Preprocessor" defStyleNum="dsPreprocessor"/> | ||||
472 | <itemData name="Replacement" defStyleNum="dsNormal" bold="true" underline="true"/> | ||||
473 | <itemData name="Section Title" defStyleNum="dsString" bold="true"/> | ||||
474 | <itemData name="Strong" defStyleNum="dsNormal" bold="true"/> | ||||
475 | <itemData name="Subscript" defStyleNum="dsNormal" underline="true"/> | ||||
476 | <itemData name="Superscript" defStyleNum="dsNormal" bold="true" underline="true"/> | ||||
477 | <itemData name="Verbatim" defStyleNum="dsDocumentation"/> | ||||
478 | </itemDatas> | ||||
479 | </highlighting> | ||||
480 | | ||||
481 | <general> | ||||
482 | <comments> | ||||
483 | <comment name="singleLine" start="//"/> | ||||
484 | <comment name="multiLine" start="////" end="////"/> | ||||
485 | </comments> | ||||
486 | <keywords casesensitive="1"/> | ||||
487 | </general> | ||||
488 | </language> |