Debian Codegraph @

data/syntax/asciidoc.xml

raw
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE language [
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 "&#x0025;">
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}|&quot;{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 "&amp;#(?:\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 <!-- macro -->
37 <!ENTITY macro "(?:anchor|xref):&id;\[.*?\]|(?:btn|footnote(?:ref)?|kbd):\[.*?\]|pass:\w*\[.*?\]|(?:icon|image|menu):[^:].*?\[.*?\]|toc::\[\]">
38
39 <!ENTITY list_marker "(?:\S.+::(?=\s|$)|(?:(?:\.+|\d+\.)|(?:-|\*+)(?:\s+\[[*x ]\])?)(?=\s+\S))">
40
41 <!ENTITY table_option_delimiter "(?:(?:\d*\.)?\d+\+|\d+\*)?(?:[&lt;&gt;^]?\.?[&lt;&gt;^])?[adehlmsv]?\|">
42
43 <!-- parts to build regular expressions to identify quoted (formatted) text
44 E.g. emphasized, marked, strong. -->
45 <!-- prefix/leading part -->
46 <!ENTITY quoted_pre "(?&lt;=^|[^\w;:}])">
47 <!ENTITY quoted_pre_pass "(?&lt;=^|\W)">
48 <!-- central part -->
49 <!ENTITY quoted "\S(?:.*?\S)??">
50 <!-- postfix/trailing part -->
51 <!ENTITY quoted_post "(?=\W|$)">
52 ]>
53 <language author="Andreas Gratzer" extensions="*.ad;*.adoc;*.asciidoc" kateversion="5.0" mimetype="text/asciidoc" name="AsciiDoc" license="MIT" section="Markup" version="9">
54 <highlighting>
55 <list name="macro">
56 <item>anchor</item>
57 <item>btn</item>
58 <item>footnote</item>
59 <item>footnoteref</item>
60 <item>icon</item>
61 <item>image</item>
62 <item>indexterm</item>
63 <item>indexterm2</item>
64 <item>kbd</item>
65 <item>menu</item>
66 <item>pass</item>
67 <item>toc</item>
68 <item>xref</item>
69 </list>
70
71 <contexts>
72 <context name="start" attribute="Normal" lineEndContext="#stay" fallthrough="1" fallthroughContext="R section block">
73 <!-- section title level 0 to 5 -->
74 <RegExpr String="^(?:={1,6}|#{1,6})\s+(?=\S)" lookAhead="1" context="dispatch section main title" column="0"/>
75 <IncludeRules context="R section inline"/>
76 </context>
77
78 <!-- attribute value definition, may span multiple lines -->
79 <context name="attribute value" attribute="Normal" lineEndContext="#stay" lineEmptyContext="#pop">
80 <!-- line with continuation -->
81 <RegExpr String=".*?(?=\s+(?:\+\s+)?\\\s*$)" attribute="Attribute Value" context="continuation"/>
82 <!-- line without continuation, terminates value definition -->
83 <RegExpr String=".*" attribute="Attribute Value" context="#pop"/>
84 </context>
85 <!-- inline attribute value definition -->
86 <context name="attribute value inline" attribute="Attribute Value" lineEndContext="#stay">
87 <!-- the leading `:` is part of the definition syntax and should not be highlighted as value -->
88 <DetectChar char=":" attribute="Attribute" context="attribute value inline L2"/>
89 <DetectChar char="}" attribute="Attribute" context="#pop"/>
90 </context>
91 <context name="attribute value inline L2" attribute="Attribute Value" lineEndContext="#stay">
92 <DetectChar char="}" attribute="Attribute" context="#pop#pop"/>
93 </context>
94
95 <!-- backlash, may function as an escape -->
96 <context name="backlash" attribute="Normal" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop">
97 <!-- attribute usage
98 formatted/quoted text
99 replacement of apostrophe
100 table separator (default)
101 anchor, consuming leading char will make anchor matches fail
102 cross reference
103 indexterm, consuming leading char will make matches fail
104 -->
105 <!-- replacement (besides apostrophe -->
106 <Detect2Chars char="&lt;" char1="-" attribute="Normal" context="#pop"/>
107 <Detect2Chars char="&lt;" char1="=" attribute="Normal" context="#pop"/>
108 <AnyChar String="_#`+*~^'|{[&lt;(" attribute="Normal" context="#pop"/>
109 <Detect2Chars char="-" char1="-" attribute="Normal" context="#pop"/>
110 <Detect2Chars char="-" char1="&gt;" attribute="Normal" context="#pop"/>
111 <Detect2Chars char="=" char1="&gt;" attribute="Normal" context="#pop"/>
112 <StringDetect String="..." attribute="Normal" context="#pop"/>
113 <!-- email - inline, needs to be ordered after mailto: -->
114 <!-- link and mailto macros, note that ftp, irc, http(s) don't match with leading `\` anyway -->
115 <RegExpr String="&email;|&link_mailto;|&char_ref;" attribute="Normal" context="#pop"/>
116 <!-- macro -->
117 <keyword String="macro" attribute="Normal" context="#pop"/>
118 </context>
119
120 <context name="block title" attribute="Block Title" lineEndContext="#pop">
121 <IncludeRules context="R title"/>
122 </context>
123
124 <context name="comment" attribute="Comment" lineEndContext="#stay" lineEmptyContext="#pop">
125 <DetectSpaces attribute="Comment"/>
126 <RegExpr String="^(&block_dels_comment;)\s*$" attribute="Comment" context="#pop!comment delimited" beginRegion="comment" column="0"/>
127 <IncludeRules context="R anchor"/>
128 <IncludeRules context="R block title"/>
129 <IncludeRules context="##Comments"/>
130 <DetectIdentifier attribute="Comment"/>
131 </context>
132 <context name="comment delimited" attribute="Comment" lineEndContext="#stay">
133 <DetectSpaces attribute="Comment"/>
134 <RegExpr String="&block_end_del;" dynamic="true" attribute="Comment" context="#pop" endRegion="comment" column="0"/>
135 <IncludeRules context="##Comments" />
136 <DetectIdentifier attribute="Comment"/>
137 </context>
138 <context name="comment single-line" attribute="Comment" lineEndContext="#pop">
139 <DetectSpaces attribute="Comment"/>
140 <IncludeRules context="##Comments" />
141 <DetectIdentifier attribute="Comment"/>
142 </context>
143
144 <!-- continuation, both for normal text and attribute value definition
145 The allowed pattern must already by validated.
146 Here only the possible characters are highlighted. -->
147 <context name="continuation" attribute="Normal" lineEndContext="#pop">
148 <AnyChar String="+\" attribute="Control"/>
149 </context>
150
151 <context name="main title" attribute="Main Title" lineEndContext="#pop!section L0">
152 <IncludeRules context="R title"/>
153 </context>
154
155 <context name="normal" attribute="Normal" lineEndContext="#stay" lineEmptyContext="#pop">
156 <RegExpr String="^(-{2}|&block_dels_normal;)\s*$" attribute="Delimiter" context="#pop!normal delimited" beginRegion="block" column="0"/>
157 <IncludeRules context="R block title"/>
158 <!-- shared rules includes anchor rules, so we do not need to include that separately -->
159 <IncludeRules context="R shared"/>
160 <IncludeRules context="R normal"/>
161 </context>
162 <context name="normal delimited" attribute="Normal" lineEndContext="#stay">
163 <RegExpr String="&block_end_del;" dynamic="true" attribute="Delimiter" context="#pop" endRegion="block" column="0"/>
164 <IncludeRules context="R admonition"/>
165 <IncludeRules context="R block"/>
166 <!-- shared rules includes anchor rules, so we do not need to include that separately -->
167 <IncludeRules context="R shared"/>
168 <IncludeRules context="R normal"/>
169 </context>
170
171 <context name="passthrough" attribute="Passthrough" lineEndContext="#stay" lineEmptyContext="#pop">
172 <DetectSpaces attribute="Passthrough"/>
173 <IncludeRules context="R include"/>
174 <DetectIdentifier attribute="Passthrough"/>
175 <RegExpr String="^(&block_dels_pass;)\s*$" attribute="Delimiter" context="#pop!passthrough delimited" beginRegion="block" column="0"/>
176 <IncludeRules context="R anchor"/>
177 <IncludeRules context="R block title"/>
178 </context>
179 <context name="passthrough delimited" attribute="Passthrough" lineEndContext="#stay">
180 <RegExpr String="&block_end_del;" dynamic="true" attribute="Delimiter" context="#pop" endRegion="block" column="0"/>
181 <IncludeRules context="R include"/>
182 </context>
183
184 <context name="dispatch section main title" attribute="Normal" lineEndContext="#stay">
185 <IncludeRules context="dispatch section title L1-5"/>
186 <!-- main title, first level 0 section title -->
187 <AnyChar String="=#" attribute="Main Title" context="#pop!main title" beginRegion="section" column="0"/>
188 </context>
189
190 <context name="dispatch section title L0-5" attribute="Normal" lineEndContext="#stay">
191 <IncludeRules context="dispatch section title L1-5"/>
192 <AnyChar String="=#" attribute="Section Title" context="#pop!section title L0" beginRegion="section" endRegion="section" column="0"/>
193 </context>
194 <context name="dispatch section title L1-5" attribute="Normal" lineEndContext="#stay">
195 <IncludeRules context="dispatch section title L2-5"/>
196 <Detect2Chars char="=" char1="=" attribute="Section Title" context="#pop!section title L1" beginRegion="section" column="0"/>
197 <Detect2Chars char="#" char1="#" attribute="Section Title" context="#pop!section title L1" beginRegion="section" column="0"/>
198 </context>
199 <context name="dispatch section title L2-5" attribute="Normal" lineEndContext="#stay">
200 <IncludeRules context="dispatch section title L3-5"/>
201 <StringDetect String="===" attribute="Section Title" context="#pop!section title L2" beginRegion="section" column="0"/>
202 <StringDetect String="###" attribute="Section Title" context="#pop!section title L2" beginRegion="section" column="0"/>
203 </context>
204 <context name="dispatch section title L3-5" attribute="Normal" lineEndContext="#stay">
205 <IncludeRules context="dispatch section title L4-5"/>
206 <StringDetect String="====" attribute="Section Title" context="#pop!section title L3" beginRegion="section" column="0"/>
207 <StringDetect String="####" attribute="Section Title" context="#pop!section title L3" beginRegion="section" column="0"/>
208 </context>
209 <context name="dispatch section title L4-5" attribute="Normal" lineEndContext="#stay">
210 <IncludeRules context="dispatch section title L5"/>
211 <StringDetect String="=====" attribute="Section Title" context="#pop!section title L4" beginRegion="section" column="0"/>
212 <StringDetect String="#####" attribute="Section Title" context="#pop!section title L4" beginRegion="section" column="0"/>
213 </context>
214 <context name="dispatch section title L5" attribute="Normal" lineEndContext="#stay">
215 <StringDetect String="======" attribute="Section Title" context="#pop!section title L5" beginRegion="section" column="0"/>
216 <StringDetect String="######" attribute="Section Title" context="#pop!section title L5" beginRegion="section" column="0"/>
217 </context>
218
219 <context name="section L0" attribute="Normal" lineEndContext="#stay" fallthrough="1" fallthroughContext="R section block">
220 <RegExpr String="^(?:={1,6}|#{1,6})\s+(?=\S)" lookAhead="1" context="dispatch section title L0-5" column="0"/>
221 <IncludeRules context="section L5"/>
222 </context>
223
224 <context name="section L1" attribute="Normal" lineEndContext="#stay" fallthrough="1" fallthroughContext="R section block">
225 <RegExpr String="^(?:={3,6}|#{3,6})\s+(?=\S)" lookAhead="1" context="dispatch section title L2-5" column="0"/>
226 <IncludeRules context="section L5"/>
227 </context>
228
229 <context name="section L2" attribute="Normal" lineEndContext="#stay" fallthrough="1" fallthroughContext="R section block">
230 <RegExpr String="^(?:={4,6}|#{4,6})\s+(?=\S)" lookAhead="1" context="dispatch section title L3-5" column="0"/>
231 <IncludeRules context="section L5"/>
232 </context>
233
234 <context name="section L3" attribute="Normal" lineEndContext="#stay" fallthrough="1" fallthroughContext="R section block">
235 <RegExpr String="^(?:={5,6}|#{5,6})\s+(?=\S)" lookAhead="1" context="dispatch section title L4-5" column="0"/>
236 <IncludeRules context="section L5"/>
237 </context>
238
239 <context name="section L4" attribute="Normal" lineEndContext="#stay" fallthrough="1" fallthroughContext="R section block">
240 <RegExpr String="^(?:={6}|#{6})\s+(?=\S)" lookAhead="1" context="dispatch section title L5" column="0"/>
241 <IncludeRules context="section L5"/>
242 </context>
243
244 <context name="section L5" attribute="Normal" lineEndContext="#stay" fallthrough="1" fallthroughContext="R section block">
245 <RegExpr String="^(?:={1,6}|#{1,6})\s+\S" lookAhead="1" context="#pop" endRegion="section" column="0"/>
246 <IncludeRules context="R section inline"/>
247 </context>
248
249 <context name="section title L0" attribute="Section Title" lineEndContext="#pop">
250 <IncludeRules context="R title"/>
251 </context>
252
253 <context name="section title L1" attribute="Section Title" lineEndContext="#pop!section L1">
254 <IncludeRules context="R title"/>
255 </context>
256
257 <context name="section title L2" attribute="Section Title" lineEndContext="#pop!section L2">
258 <IncludeRules context="R title"/>
259 </context>
260
261 <context name="section title L3" attribute="Section Title" lineEndContext="#pop!section L3">
262 <IncludeRules context="R title"/>
263 </context>
264
265 <context name="section title L4" attribute="Section Title" lineEndContext="#pop!section L4">
266 <IncludeRules context="R title"/>
267 </context>
268
269 <context name="section title L5" attribute="Section Title" lineEndContext="#pop!section L5">
270 <IncludeRules context="R title"/>
271 </context>
272
273 <context name="table" attribute="Normal" lineEndContext="#stay">
274 <RegExpr String="&block_end_del;" dynamic="true" attribute="Delimiter" context="#pop" endRegion="block" column="0"/>
275 <!-- `|` with prefix for alignment, style etc. -->
276 <RegExpr String="(?&lt;=^|\s)&table_option_delimiter;" attribute="Delimiter"/>
277 <!-- simple `|` without alignment, style etc. -->
278 <DetectChar char="|" attribute="Delimiter"/>
279 <IncludeRules context="R shared"/>
280 <IncludeRules context="R normal"/>
281 </context>
282
283 <context name="verbatim" attribute="Verbatim" lineEndContext="#stay">
284 <RegExpr String="^(-{2}|&block_dels_verbatim;)\s*$" attribute="Delimiter" context="#pop!verbatim delimited" beginRegion="block" column="0"/>
285 <IncludeRules context="R anchor"/>
286 <RegExpr String="^(\[\w+[^,\]]*(,[^,\]]*)*\]\s*)+$" attribute="Preprocessor" column="0"/>
287 <IncludeRules context="R block title"/>
288 <IncludeRules context="R comment"/>
289 <IncludeRules context="R include"/>
290 <RegExpr String="^.*" attribute="Verbatim" context="#pop!verbatim paragraph" column="0"/>
291 </context>
292 <context name="verbatim delimited" attribute="Verbatim" lineEndContext="#stay">
293 <RegExpr String="&block_end_del;" dynamic="true" attribute="Delimiter" context="#pop" endRegion="block" column="0"/>
294 <IncludeRules context="R include"/>
295 </context>
296 <context name="verbatim paragraph" attribute="Verbatim" lineEndContext="#stay" lineEmptyContext="#pop">
297 <IncludeRules context="R include"/>
298 </context>
299
300 <!-- contexts to be used for IncludeRules only -->
301
302 <context name="R normal" attribute="Normal" lineEndContext="#stay">
303 <!-- Regex which allows to quickly consume text that is not
304 - macro
305 - continuation
306 - index term
307 - link
308 - replacement
309 - preprocessor
310 - formatted text
311 - table delimiter
312
313 maanchor:anchor-id[Macro Anchor]
314 ^ Normal
315 ^ Macro
316
317 bla__bla__bla
318 ^ Normal
319 ^ Emphasized
320 ^ Normal
321
322 For some reason, Asciidoctor recognizes emails with leading : or / but does not render them as link
323
324 /[email protected]
325 ^ Normal
326
327 [email protected]
328 ^ Link
329 -->
330 <RegExpr String="([:/]&email;|(?!&macro;|link:|mailto:|(?:ftp|https?|irc)://|&char_ref;|indexterm2?:\[.+?\]|[\\+|\[{~^]|__|##|\([CR]\)|\(TM\)|\.\.\.|&lt;[-=&lt;]|--|->|=>|``\*?_?|\*\*_?|\(\(|\s+[[+]|\s&table_option_delimiter;|(?&lt;=[^&alp;;:}])_|&quoted_pre;(`\*?_?|\*_?|#)|(?&lt;=[&alp;])'(?=[&alp;])|&email;).)++" attribute="Normal"/>
331 </context>
332
333 <context name="R admonition" attribute="Normal" lineEndContext="#stay">
334 <!-- admonition - simple form, block form is part of block rules -->
335 <RegExpr String="^(?:&admonition_names;):(?=\s+\S)" attribute="Preprocessor" context="normal" column="0"/>
336 </context>
337
338 <context name="R anchor" attribute="Normal" lineEndContext="#stay">
339 <!-- shorthand form at line start -->
340 <!-- bibliographic anchor -->
341 <!-- normal form -->
342 <!-- shorthand form inline -->
343 <RegExpr String="^\[#&anchor_mid;\](?:&anchor_phrase;|\s*$)|\[{3}&anchor_mid;\]{3}|\[{2}&anchor_mid;\]{2}|(?&lt;=\S\s)\s*\[\s*#&anchor_mid;\s*\]&anchor_phrase;" attribute="Anchor"/>
344 </context>
345
346 <context name="R attribute" attribute="Normal" lineEndContext="#stay">
347 <!-- attribute definition without value / unset attribute -->
348 <RegExpr String="^:!?&id;!?:$" attribute="Attribute" column="0"/>
349 <!-- attribute definition with value -->
350 <RegExpr String="^:!?&id;!?:\s(?=\S)" attribute="Attribute" context="attribute value" column="0"/>
351 <!-- attribute inline definition -->
352 <RegExpr String="\{set:&id;(?=(?::.*)?\})" minimal="true" attribute="Attribute" context="attribute value inline"/>
353 <IncludeRules context="R attribute usage"/>
354 </context>
355
356 <context name="R attribute usage" attribute="Normal" lineEndContext="#stay">
357 <RegExpr String="\{&id;\}" attribute="Attribute"/>
358 </context>
359
360 <context name="R block" attribute="Normal" lineEndContext="#stay">
361 <IncludeRules context="R block title"/>
362 <IncludeRules context="R block without title"/>
363 </context>
364
365 <context name="R block without title" attribute="Normal" lineEndContext="#stay">
366 <!-- name matching -->
367 <RegExpr String="^\[(?:&admonition_names;)&block_name_post;|^\[(?:example|quote|sidebar|verse)&block_name_post;" attribute="Preprocessor" context="normal" column="0"/>
368 <RegExpr String="^\[(?:pass|stem)&block_name_post;" attribute="Preprocessor" context="passthrough" column="0"/>
369 <RegExpr String="^\[(?:listing|literal|source)&block_name_post;" attribute="Preprocessor" context="verbatim" column="0"/>
370
371 <!-- delimiter matching -->
372 <RegExpr String="^(&block_dels_normal;)\s*$" attribute="Delimiter" context="normal delimited" beginRegion="block" column="0"/>
373 <RegExpr String="^(&block_dels_pass;)\s*$" attribute="Delimiter" context="passthrough delimited" beginRegion="block" column="0"/>
374 <RegExpr String="^(\|={3,})\s*$" attribute="Delimiter" context="table" beginRegion="block" column="0"/>
375 <RegExpr String="^(&block_dels_verbatim;)\s*$" attribute="Delimiter" context="verbatim delimited" beginRegion="block" column="0"/>
376 </context>
377
378 <context name="R block title" attribute="Normal" lineEndContext="#stay">
379 <!-- not more than 3 leading dots followed by a non-dot, otherwise it would conflict with the delimited literal block -->
380 <RegExpr String="^\.{1,3}(?=[^\.\s])" attribute="Block Title" context="block title" column="0"/>
381 </context>
382
383 <context name="R comment" attribute="Normal" lineEndContext="#stay">
384 <!-- comment - multi-line, named block -->
385 <RegExpr String="^\[comment&block_name_post;" attribute="Preprocessor" context="comment" column="0"/>
386 <!-- comment - multi-line, delimited block -->
387 <RegExpr String="^(&block_dels_comment;)\s*$" attribute="Comment" context="comment delimited" beginRegion="comment" column="0"/>
388 <!-- comment - single line -->
389 <RegExpr String="^/{2}(?:[^/]|$)" attribute="Comment" context="comment single-line" column="0"/>
390 </context>
391
392 <context name="R formatted" attribute="Normal" lineEndContext="#stay">
393 <!-- custom style, e.g. [underline]#underlined text# -->
394 <RegExpr String="(?&lt;=^|\W)\[[^\]]+?\]([#_`*]{1,2})&quoted;\g1&quoted_post;" attribute="Preprocessor"/>
395
396 <!-- combined highlighting must be ordered before simple highlighting -->
397
398 <!-- emphasized monospaced strong unconstrained - must be ordered before constrained -->
399 <!-- emphasized monospaced strong - constrained must be ordered after unconstrained -->
400 <RegExpr String="`{2}\*_.*?_\*`{2}|&quoted_pre;`\*_&quoted;_\*`&quoted_post;" attribute="Emphasized Monospaced Strong"/>
401
402 <!-- emphasized strong unconstrained - must be ordered before constrained -->
403 <!-- emphasized strong constrained - must be ordered after unconstrained -->
404 <RegExpr String="\*{2}_.*?_\*{2}|&quoted_pre;\*_&quoted;_\*&quoted_post;" attribute="Emphasized Strong"/>
405
406 <!-- monospaced strong unconstrained - must be ordered before constrained -->
407 <!-- monospaced strong constrained - must be ordered after unconstrained -->
408 <RegExpr String="`{2}\*.*?\*`{2}|&quoted_pre;`\*&quoted;\*`&quoted_post;" attribute="Monospaced Strong"/>
409
410 <!-- emphasized monospaced unconstrained - must be ordered before constrained -->
411 <!-- emphasized monospaced constrained - must be ordered after unconstrained -->
412 <RegExpr String="`{2}_.*?_`{2}|&quoted_pre;`_&quoted;_`&quoted_post;" attribute="Emphasized Monospaced"/>
413
414 <!-- strong unconstrained - must be ordered before constrained -->
415 <!-- strong constrained - must be ordered after unconstrained -->
416 <RegExpr String="\*{2}[^*].*?\*{2}|&quoted_pre;\*&quoted;\*&quoted_post;" attribute="Strong"/>
417
418 <!-- emphasized unconstrained - must be ordered before constrained -->
419 <!-- emphasized constrained - must be ordered after unconstrained
420 Can't use &quoted_pre; as that excludes \w which excludes `_` too. -->
421 <RegExpr String="_{2}[^_].*?_{2}|(?&lt;=^|[^&alp;;:}])_&quoted;_&quoted_post;" attribute="Emphasized"/>
422
423 <IncludeRules context="R marked"/>
424 <IncludeRules context="R monospaced"/>
425
426 <!-- subscript -->
427 <RegExpr String="~\S+~" minimal="true" attribute="Subscript"/>
428 <!-- superscript -->
429 <RegExpr String="\^\S+\^" minimal="true" attribute="Superscript"/>
430 </context>
431
432 <context name="R include" attribute="Normal" lineEndContext="#stay">
433 <RegExpr String="^include::.*\[.*?\](?=\s*$)" attribute="Preprocessor" column="0"/>
434 </context>
435
436 <context name="R macro" attribute="Normal" lineEndContext="#stay">
437 <RegExpr String="&macro;" attribute="Preprocessor"/>
438 </context>
439
440 <context name="R marked" attribute="Normal" lineEndContext="#stay">
441 <!-- marked unconstrained - must be ordered before constrained -->
442 <!-- marked constrained - must be ordered after unconstrained -->
443 <RegExpr String="#{2}.+?#{2}|&quoted_pre;#&quoted;#&quoted_post;" attribute="Marked"/>
444 </context>
445
446 <context name="R monospaced" attribute="Normal" lineEndContext="#stay">
447 <!-- monospaced unconstrained - must be ordered before constrained -->
448 <!-- monospaced constrained - must be ordered after unconstrained -->
449 <RegExpr String="`{2}[^`].*?`{2}|&quoted_pre;`&quoted;`&quoted_post;" attribute="Monospaced"/>
450 </context>
451
452 <!-- replacements -->
453 <context name="R replacement" attribute="Normal" lineEndContext="#stay">
454 <!-- copyright -->
455 <StringDetect String="(C)" attribute="Replacement"/>
456 <!-- registered -->
457 <StringDetect String="(R)" attribute="Replacement"/>
458 <!-- trademark -->
459 <StringDetect String="(TM)" attribute="Replacement"/>
460 <!-- apostrophe, only when between alphabetic characters -->
461 <RegExpr String="(?&lt;=[&alp;])'(?=[&alp;])" attribute="Replacement"/>
462 <!-- ellipses -->
463 <StringDetect String="..." attribute="Replacement"/>
464 <!-- mdash -->
465 <Detect2Chars char="-" char1="-" attribute="Replacement"/>
466 <!-- left single arrow -->
467 <Detect2Chars char="&lt;" char1="-" attribute="Replacement"/>
468 <!-- right single arrow -->
469 <Detect2Chars char="-" char1="&gt;" attribute="Replacement"/>
470 <!-- left double arrow -->
471 <Detect2Chars char="&lt;" char1="=" attribute="Replacement"/>
472 <!-- right double arrow -->
473 <Detect2Chars char="=" char1="&gt;" attribute="Replacement"/>
474 <!-- unicode character reference -->
475 <RegExpr String="&char_ref;" attribute="Replacement"/>
476 </context>
477
478 <context name="R section inline" attribute="Normal" lineEndContext="#stay">
479 <!-- literal paragraph started by a line with leading spaces -->
480 <RegExpr String="^\s+(?!&list_marker;)\S.*" attribute="Verbatim" context="verbatim paragraph" column="0"/>
481 <IncludeRules context="R block"/>
482 <IncludeRules context="R anchor"/>
483 <IncludeRules context="R comment"/>
484 <IncludeRules context="R media"/>
485 <IncludeRules context="R preprocessor"/>
486 <IncludeRules context="R horizontal rules and page break"/>
487 </context>
488
489 <!-- first line of a section block -->
490 <context name="R section block" attribute="Normal" lineEndContext="#pop!section block continuation" lineEmptyContext="#pop">
491 <IncludeRules context="R callout"/>
492 <RegExpr String="^\+\s*$" attribute="Control" context="#pop" column="0"/>
493 <IncludeRules context="R admonition"/>
494 <IncludeRules context="R block"/>
495 <IncludeRules context="R shared"/>
496 <IncludeRules context="R empty"/>
497 <IncludeRules context="R normal"/>
498 </context>
499
500 <!-- callout as being used below a source code block -->
501 <context name="R callout" attribute="Normal" lineEndContext="#stay" lineEmptyContext="#pop">
502 <RegExpr String="^&lt;(?:\.|\d+)&gt;(?=\s+\S)" attribute="Callout" context="#pop!callout" column="0"/>
503 </context>
504 <context name="callout" attribute="Normal" lineEndContext="#stay" lineEmptyContext="#pop">
505 <IncludeRules context="R callout"/>
506 <IncludeRules context="section block continuation"/>
507 </context>
508
509 <!-- line 2 and following of a section block -->
510 <context name="section block continuation" attribute="Normal" lineEndContext="#stay" lineEmptyContext="#pop">
511 <RegExpr String="^\+\s*$" attribute="Control" context="#pop" column="0"/>
512 <IncludeRules context="R block without title"/>
513 <IncludeRules context="R shared"/>
514 <IncludeRules context="R empty"/>
515 <IncludeRules context="R normal"/>
516 </context>
517
518 <context name="R empty" attribute="Normal" lineEndContext="#stay">
519 <RegExpr String="^\s+$" attribute="Normal" context="#pop" column="0"/>
520 </context>
521
522 <context name="R shared" attribute="Normal" lineEndContext="#stay">
523 <!-- the escaped forms must be ordered before the not escaped forms -->
524 <DetectChar char="\" attribute="Normal" context="backlash"/>
525
526 <!-- passthrough - inline, must be ordered before other rules
527 The macro form pass: is part of "R macro" context -->
528 <RegExpr String="&quoted_pre_pass;(\+{1,3})&quoted;\g1&quoted_post;" attribute="Passthrough"/>
529
530 <IncludeRules context="R anchor"/>
531 <IncludeRules context="R attribute"/>
532 <IncludeRules context="R comment"/>
533 <IncludeRules context="R include"/>
534 <IncludeRules context="R macro"/>
535
536 <!-- counter and counter2 -->
537 <RegExpr String="\{counter2?:\s*&id;\s*(?::\s*(?:\d+|[&alp;])\s*)?\}" minimal="true" attribute="Attribute"/>
538
539 <!-- horizontal rules and page break -->
540 <!-- to enable highlighting of the horizontal rules using "- - -" or "* * *",
541 keep this before the checklist and unnumbered list definition -->
542 <IncludeRules context="R horizontal rules and page break"/>
543
544 <!-- cross reference -->
545 <RegExpr String="&lt;&lt;[^&lt;\s].*?&gt;&gt;" attribute="Link"/>
546
547 <!-- index term -->
548 <RegExpr String="\({3}.+?\){3}|\({2}.+?\){2}|indexterm2?:\[.+?\]" attribute="Preprocessor"/>
549
550 <!-- marker for description list -->
551 <!-- marker for numbered list -->
552 <!-- marker for checklist and bulleted/unnumbered list
553 To enable highlighting of the horizontal rules using "- - -" or "* * *",
554 keep this after the horizontal rules definition -->
555 <RegExpr String="^\s*&list_marker;" attribute="List Marker" column="0"/>
556
557 <!-- media - block format -->
558 <IncludeRules context="R media"/>
559
560 <!-- links -->
561 <RegExpr String="(?&lt;=^|[\s\[\]();&lt;&gt;])(?:ftp|https?|irc)://[^\s\[]*?(?:\[\]|\[.*?[^\\]\]|(?=(?:[\[\]]|[\.,;:]??(?:\s|$))))|&link_mailto;|&email;" attribute="Link"/>
562
563 <!-- preprocessor -->
564 <!-- general meta data attribute list - must be ordered after other rules matching for lines of the form of [some content] -->
565 <IncludeRules context="R preprocessor"/>
566
567 <!-- continuation `+`, both at end of line and on a line on its own -->
568 <RegExpr String="(?:^|\s)\s*\+\s*$" lookAhead="true" attribute="Normal" context="continuation"/>
569
570 <!-- formatted/quoted must be ordered after unnumbered list -->
571 <IncludeRules context="R formatted"/>
572 <!-- replacements are done only if nothing else matched -->
573 <IncludeRules context="R replacement"/>
574 </context>
575
576 <context name="R media" attribute="Normal" lineEndContext="#stay">
577 <RegExpr String="^(?:audio|image|video)::.*\[.*?\](?=\s*$)" attribute="Preprocessor" column="0"/>
578 </context>
579
580 <context name="R preprocessor" attribute="Normal" lineEndContext="#stay">
581 <RegExpr String="^ifn?def::&id;(?:[,\+]&id;)*\[.*\]|^ifeval::\[.*\]|^endif::(?:&id;)?\[\]|^\[[^\s\[].*\](?=\s*$)" attribute="Preprocessor" column="0"/>
582 </context>
583
584 <context name="R horizontal rules and page break" attribute="Normal" lineEndContext="#stay">
585 <RegExpr String="^(?:'{3}|-{3}|\*{3}|- - -|\* \* \*|&lt;{3})\s*$" attribute="Control" column="0"/>
586 </context>
587
588 <!-- common rules for main title, section title, block title -->
589 <context name="R title" attribute="Normal" lineEndContext="#stay">
590 <DetectSpaces/>
591 <DetectIdentifier/>
592 <!-- the escaped forms must be ordered before the not escaped forms -->
593 <DetectChar char="\" attribute="Section Title" context="backlash"/>
594 <IncludeRules context="R anchor"/>
595 <IncludeRules context="R attribute usage"/>
596 <IncludeRules context="R marked"/>
597 <IncludeRules context="R monospaced"/>
598 </context>
599 </contexts>
600
601 <itemDatas>
602 <itemData name="Anchor" defStyleNum="dsFunction"/>
603 <itemData name="Attribute" defStyleNum="dsVariable"/>
604 <itemData name="Attribute Value" defStyleNum="dsVariable" italic="true"/>
605 <itemData name="Block Title" defStyleNum="dsString" italic="true"/>
606 <itemData name="Callout" defStyleNum="dsNormal" bold="true" underline="true"/>
607 <itemData name="Comment" defStyleNum="dsComment"/>
608 <itemData name="Control" defStyleNum="dsControlFlow" bold="true" underline="true"/>
609 <itemData name="Delimiter" defStyleNum="dsPreprocessor" bold="true"/>
610 <itemData name="Emphasized" defStyleNum="dsNormal" italic="true"/>
611 <itemData name="Emphasized Monospaced" defStyleNum="dsDocumentation" italic="true"/>
612 <itemData name="Emphasized Monospaced Strong" defStyleNum="dsDocumentation" bold="true" italic="true"/>
613 <itemData name="Emphasized Strong" defStyleNum="dsNormal" bold="true" italic="true"/>
614 <itemData name="Link" defStyleNum="dsVariable" underline="true"/>
615 <itemData name="List Marker" defStyleNum="dsNormal" bold="true"/>
616 <itemData name="Main Title" defStyleNum="dsNormal" bold="true"/>
617 <itemData name="Marked" defStyleNum="dsFloat"/>
618 <itemData name="Monospaced" defStyleNum="dsDocumentation"/>
619 <itemData name="Monospaced Strong" defStyleNum="dsDocumentation" bold="true"/>
620 <itemData name="Normal" defStyleNum="dsNormal"/>
621 <itemData name="Passthrough" defStyleNum="dsSpecialString"/>
622 <itemData name="Preprocessor" defStyleNum="dsPreprocessor"/>
623 <itemData name="Replacement" defStyleNum="dsNormal" bold="true" underline="true"/>
624 <itemData name="Section Title" defStyleNum="dsString" bold="true"/>
625 <itemData name="Strong" defStyleNum="dsNormal" bold="true"/>
626 <itemData name="Subscript" defStyleNum="dsNormal" underline="true"/>
627 <itemData name="Superscript" defStyleNum="dsNormal" bold="true" underline="true"/>
628 <itemData name="Verbatim" defStyleNum="dsDocumentation"/>
629 </itemDatas>
630 </highlighting>
631
632 <general>
633 <comments>
634 <comment name="singleLine" start="//"/>
635 <comment name="multiLine" start="////" end="////" region="comment"/>
636 </comments>
637 <keywords casesensitive="1"/>
638 </general>
639 </language>
640 <!-- kate: replace-tabs on; tab-width 4; indent-width 4; -->