4229
|
1 " Vim syntax file
|
|
2 " Language: AsciiDoc
|
|
3 " Author: Stuart Rackham <srackham@gmail.com> (inspired by Felix
|
|
4 " Obenhuber's original asciidoc.vim script).
|
|
5 " URL: http://asciidoc.org/
|
|
6 " Licence: GPL (http://www.gnu.org)
|
|
7 " Remarks: Vim 6 or greater
|
6180
|
8 " Last Update: 2014 Aug 29 (see Issue 240)
|
4229
|
9 " Limitations:
|
|
10 "
|
|
11 " - Nested quoted text formatting is highlighted according to the outer
|
|
12 " format.
|
|
13 " - If a closing Example Block delimiter may be mistaken for a title
|
|
14 " underline. A workaround is to insert a blank line before the closing
|
|
15 " delimiter.
|
|
16 " - Lines within a paragraph starting with equals characters are
|
|
17 " highlighted as single-line titles.
|
|
18 " - Lines within a paragraph beginning with a period are highlighted as
|
|
19 " block titles.
|
|
20
|
|
21
|
|
22 if exists("b:current_syntax")
|
|
23 finish
|
|
24 endif
|
|
25
|
|
26 syn clear
|
|
27 syn sync fromstart
|
|
28 syn sync linebreaks=100
|
|
29
|
|
30 " Run :help syn-priority to review syntax matching priority.
|
|
31 syn keyword asciidocToDo TODO FIXME CHECK TEST XXX ZZZ DEPRECATED
|
|
32 syn match asciidocBackslash /\\/
|
|
33 syn region asciidocIdMarker start=/^\$Id:\s/ end=/\s\$$/
|
|
34 syn match asciidocCallout /\\\@<!<\d\{1,2}>/
|
|
35 syn match asciidocOpenBlockDelimiter /^--$/
|
|
36 syn match asciidocLineBreak /[ \t]+$/ containedin=asciidocList
|
|
37 syn match asciidocRuler /^'\{3,}$/
|
|
38 syn match asciidocPagebreak /^<\{3,}$/
|
|
39 syn match asciidocEntityRef /\\\@<!&[#a-zA-Z]\S\{-};/
|
|
40 syn region asciidocLiteralParagraph start=/\(\%^\|\_^\s*\n\)\@<=\s\+\S\+/ end=/\(^\(+\|--\)\?\s*$\)\@=/ contains=asciidocToDo
|
|
41 syn match asciidocURL /\\\@<!\<\(http\|https\|ftp\|file\|irc\):\/\/[^| \t]*\(\w\|\/\)/
|
|
42 syn match asciidocEmail /[\\.:]\@<!\(\<\|<\)\w\(\w\|[.-]\)*@\(\w\|[.-]\)*\w>\?[0-9A-Za-z_]\@!/
|
|
43 syn match asciidocAttributeRef /\\\@<!{\w\(\w\|[-,+]\)*\([=!@#$%?:].*\)\?}/
|
|
44
|
|
45 " As a damage control measure quoted patterns always terminate at a blank
|
|
46 " line (see 'Limitations' above).
|
|
47 syn match asciidocQuotedAttributeList /\\\@<!\[[a-zA-Z0-9_-][a-zA-Z0-9 _-]*\][+_'`#*]\@=/
|
|
48 syn match asciidocQuotedSubscript /\\\@<!\~\S\_.\{-}\(\~\|\n\s*\n\)/ contains=asciidocEntityRef
|
|
49 syn match asciidocQuotedSuperscript /\\\@<!\^\S\_.\{-}\(\^\|\n\s*\n\)/ contains=asciidocEntityRef
|
|
50
|
|
51 syn match asciidocQuotedMonospaced /\(^\|[| \t([.,=\]]\)\@<=+\([+ \n\t]\)\@!\(.\|\n\(\s*\n\)\@!\)\{-}\S\(+\([| \t)[\],.?!;:=]\|$\)\@=\)/ contains=asciidocEntityRef
|
|
52 syn match asciidocQuotedMonospaced2 /\(^\|[| \t([.,=\]]\)\@<=`\([` \n\t]\)\@!\(.\|\n\(\s*\n\)\@!\)\{-}\S\(`\([| \t)[\],.?!;:=]\|$\)\@=\)/
|
|
53 syn match asciidocQuotedUnconstrainedMonospaced /[\\+]\@<!++\S\_.\{-}\(++\|\n\s*\n\)/ contains=asciidocEntityRef
|
|
54
|
|
55 syn match asciidocQuotedEmphasized /\(^\|[| \t([.,=\]]\)\@<=_\([_ \n\t]\)\@!\(.\|\n\(\s*\n\)\@!\)\{-}\S\(_\([| \t)[\],.?!;:=]\|$\)\@=\)/ contains=asciidocEntityRef
|
|
56 syn match asciidocQuotedEmphasized2 /\(^\|[| \t([.,=\]]\)\@<='\([' \n\t]\)\@!\(.\|\n\(\s*\n\)\@!\)\{-}\S\('\([| \t)[\],.?!;:=]\|$\)\@=\)/ contains=asciidocEntityRef
|
|
57 syn match asciidocQuotedUnconstrainedEmphasized /\\\@<!__\S\_.\{-}\(__\|\n\s*\n\)/ contains=asciidocEntityRef
|
|
58
|
|
59 syn match asciidocQuotedBold /\(^\|[| \t([.,=\]]\)\@<=\*\([* \n\t]\)\@!\(.\|\n\(\s*\n\)\@!\)\{-}\S\(\*\([| \t)[\],.?!;:=]\|$\)\@=\)/ contains=asciidocEntityRef
|
|
60 syn match asciidocQuotedUnconstrainedBold /\\\@<!\*\*\S\_.\{-}\(\*\*\|\n\s*\n\)/ contains=asciidocEntityRef
|
|
61
|
|
62 " Don't allow ` in single quoted (a kludge to stop confusion with `monospaced`).
|
|
63 syn match asciidocQuotedSingleQuoted /\(^\|[| \t([.,=\]]\)\@<=`\([` \n\t]\)\@!\([^`]\|\n\(\s*\n\)\@!\)\{-}[^` \t]\('\([| \t)[\],.?!;:=]\|$\)\@=\)/ contains=asciidocEntityRef
|
|
64
|
|
65 syn match asciidocQuotedDoubleQuoted /\(^\|[| \t([.,=\]]\)\@<=``\([` \n\t]\)\@!\(.\|\n\(\s*\n\)\@!\)\{-}\S\(''\([| \t)[\],.?!;:=]\|$\)\@=\)/ contains=asciidocEntityRef
|
|
66
|
|
67 syn match asciidocDoubleDollarPassthrough /\\\@<!\(^\|[^0-9a-zA-Z$]\)\@<=\$\$..\{-}\(\$\$\([^0-9a-zA-Z$]\|$\)\@=\|^$\)/
|
|
68 syn match asciidocTriplePlusPassthrough /\\\@<!\(^\|[^0-9a-zA-Z$]\)\@<=+++..\{-}\(+++\([^0-9a-zA-Z$]\|$\)\@=\|^$\)/
|
|
69
|
|
70 syn match asciidocAdmonition /^\u\{3,15}:\(\s\+.*\)\@=/
|
|
71
|
|
72 syn region asciidocTable_OLD start=/^\([`.']\d*[-~_]*\)\+[-~_]\+\d*$/ end=/^$/
|
|
73 syn match asciidocBlockTitle /^\.[^. \t].*[^-~_]$/ contains=asciidocQuoted.*,asciidocAttributeRef
|
|
74 syn match asciidocTitleUnderline /[-=~^+]\{2,}$/ transparent contained contains=NONE
|
|
75 syn match asciidocOneLineTitle /^=\{1,5}\s\+\S.*$/ contains=asciidocQuoted.*,asciidocMacroAttributes,asciidocAttributeRef,asciidocEntityRef,asciidocEmail,asciidocURL,asciidocBackslash
|
|
76 syn match asciidocTwoLineTitle /^[^. +/].*[^.]\n[-=~^+]\{3,}$/ contains=asciidocQuoted.*,asciidocMacroAttributes,asciidocAttributeRef,asciidocEntityRef,asciidocEmail,asciidocURL,asciidocBackslash,asciidocTitleUnderline
|
|
77
|
|
78 syn match asciidocAttributeList /^\[[^[ \t].*\]$/
|
|
79 syn match asciidocQuoteBlockDelimiter /^_\{4,}$/
|
|
80 syn match asciidocExampleBlockDelimiter /^=\{4,}$/
|
|
81 syn match asciidocSidebarDelimiter /^*\{4,}$/
|
|
82
|
|
83 " See http://vimdoc.sourceforge.net/htmldoc/usr_44.html for excluding region
|
|
84 " contents from highlighting.
|
|
85 syn match asciidocTablePrefix /\(\S\@<!\(\([0-9.]\+\)\([*+]\)\)\?\([<\^>.]\{,3}\)\?\([a-z]\)\?\)\?|/ containedin=asciidocTableBlock contained
|
|
86 syn region asciidocTableBlock matchgroup=asciidocTableDelimiter start=/^|=\{3,}$/ end=/^|=\{3,}$/ keepend contains=ALL
|
|
87 syn match asciidocTablePrefix /\(\S\@<!\(\([0-9.]\+\)\([*+]\)\)\?\([<\^>.]\{,3}\)\?\([a-z]\)\?\)\?!/ containedin=asciidocTableBlock contained
|
|
88 syn region asciidocTableBlock2 matchgroup=asciidocTableDelimiter2 start=/^!=\{3,}$/ end=/^!=\{3,}$/ keepend contains=ALL
|
|
89
|
|
90 syn match asciidocListContinuation /^+$/
|
|
91 syn region asciidocLiteralBlock start=/^\.\{4,}$/ end=/^\.\{4,}$/ contains=asciidocCallout,asciidocToDo keepend
|
|
92 syn region asciidocListingBlock start=/^-\{4,}$/ end=/^-\{4,}$/ contains=asciidocCallout,asciidocToDo keepend
|
|
93 syn region asciidocCommentBlock start="^/\{4,}$" end="^/\{4,}$" contains=asciidocToDo
|
|
94 syn region asciidocPassthroughBlock start="^+\{4,}$" end="^+\{4,}$"
|
|
95
|
|
96 " Allowing leading \w characters in the filter delimiter is to accomodate
|
|
97 " the pre version 8.2.7 syntax and may be removed in future releases.
|
|
98 syn region asciidocFilterBlock start=/^\w*\~\{4,}$/ end=/^\w*\~\{4,}$/
|
|
99
|
|
100 syn region asciidocMacroAttributes matchgroup=asciidocRefMacro start=/\\\@<!<<"\{-}\(\w\|-\|_\|:\|\.\)\+"\?,\?/ end=/\(>>\)\|^$/ contains=asciidocQuoted.* keepend
|
|
101 syn region asciidocMacroAttributes matchgroup=asciidocAnchorMacro start=/\\\@<!\[\{2}\(\w\|-\|_\|:\|\.\)\+,\?/ end=/\]\{2}/ keepend
|
|
102 syn region asciidocMacroAttributes matchgroup=asciidocAnchorMacro start=/\\\@<!\[\{3}\(\w\|-\|_\|:\|\.\)\+/ end=/\]\{3}/ keepend
|
|
103 syn region asciidocMacroAttributes matchgroup=asciidocMacro start=/[\\0-9a-zA-Z]\@<!\w\(\w\|-\)*:\S\{-}\[/ skip=/\\\]/ end=/\]\|^$/ contains=asciidocQuoted.*,asciidocAttributeRef,asciidocEntityRef keepend
|
|
104 " Highlight macro that starts with an attribute reference (a common idiom).
|
|
105 syn region asciidocMacroAttributes matchgroup=asciidocMacro start=/\(\\\@<!{\w\(\w\|[-,+]\)*\([=!@#$%?:].*\)\?}\)\@<=\S\{-}\[/ skip=/\\\]/ end=/\]\|^$/ contains=asciidocQuoted.*,asciidocAttributeRef keepend
|
|
106 syn region asciidocMacroAttributes matchgroup=asciidocIndexTerm start=/\\\@<!(\{2,3}/ end=/)\{2,3}/ contains=asciidocQuoted.*,asciidocAttributeRef keepend
|
|
107
|
|
108 syn match asciidocCommentLine "^//\([^/].*\|\)$" contains=asciidocToDo
|
|
109
|
|
110 syn region asciidocAttributeEntry start=/^:\w/ end=/:\(\s\|$\)/ oneline
|
|
111
|
|
112 " Lists.
|
|
113 syn match asciidocListBullet /^\s*\zs\(-\|\*\{1,5}\)\ze\s/
|
|
114 syn match asciidocListNumber /^\s*\zs\(\(\d\+\.\)\|\.\{1,5}\|\(\a\.\)\|\([ivxIVX]\+)\)\)\ze\s\+/
|
|
115 syn region asciidocListLabel start=/^\s*/ end=/\(:\{2,4}\|;;\)$/ oneline contains=asciidocQuoted.*,asciidocMacroAttributes,asciidocAttributeRef,asciidocEntityRef,asciidocEmail,asciidocURL,asciidocBackslash,asciidocToDo keepend
|
|
116 " DEPRECATED: Horizontal label.
|
|
117 syn region asciidocHLabel start=/^\s*/ end=/\(::\|;;\)\(\s\+\|\\$\)/ oneline contains=asciidocQuoted.*,asciidocMacroAttributes keepend
|
|
118 " Starts with any of the above.
|
|
119 syn region asciidocList start=/^\s*\(-\|\*\{1,5}\)\s/ start=/^\s*\(\(\d\+\.\)\|\.\{1,5}\|\(\a\.\)\|\([ivxIVX]\+)\)\)\s\+/ start=/.\+\(:\{2,4}\|;;\)$/ end=/\(^[=*]\{4,}$\)\@=/ end=/\(^\(+\|--\)\?\s*$\)\@=/ contains=asciidocList.\+,asciidocQuoted.*,asciidocMacroAttributes,asciidocAttributeRef,asciidocEntityRef,asciidocEmail,asciidocURL,asciidocBackslash,asciidocCommentLine,asciidocAttributeList,asciidocToDo
|
|
120
|
|
121 hi def link asciidocAdmonition Special
|
|
122 hi def link asciidocAnchorMacro Macro
|
|
123 hi def link asciidocAttributeEntry Special
|
|
124 hi def link asciidocAttributeList Special
|
|
125 hi def link asciidocAttributeMacro Macro
|
|
126 hi def link asciidocAttributeRef Special
|
|
127 hi def link asciidocBackslash Special
|
|
128 hi def link asciidocBlockTitle Title
|
|
129 hi def link asciidocCallout Label
|
|
130 hi def link asciidocCommentBlock Comment
|
|
131 hi def link asciidocCommentLine Comment
|
|
132 hi def link asciidocDoubleDollarPassthrough Special
|
|
133 hi def link asciidocEmail Macro
|
|
134 hi def link asciidocEntityRef Special
|
|
135 hi def link asciidocExampleBlockDelimiter Type
|
|
136 hi def link asciidocFilterBlock Type
|
|
137 hi def link asciidocHLabel Label
|
|
138 hi def link asciidocIdMarker Special
|
|
139 hi def link asciidocIndexTerm Macro
|
|
140 hi def link asciidocLineBreak Special
|
|
141 hi def link asciidocOpenBlockDelimiter Label
|
|
142 hi def link asciidocListBullet Label
|
|
143 hi def link asciidocListContinuation Label
|
|
144 hi def link asciidocListingBlock Identifier
|
|
145 hi def link asciidocListLabel Label
|
|
146 hi def link asciidocListNumber Label
|
|
147 hi def link asciidocLiteralBlock Identifier
|
|
148 hi def link asciidocLiteralParagraph Identifier
|
|
149 hi def link asciidocMacroAttributes Label
|
|
150 hi def link asciidocMacro Macro
|
|
151 hi def link asciidocOneLineTitle Title
|
|
152 hi def link asciidocPagebreak Type
|
|
153 hi def link asciidocPassthroughBlock Identifier
|
|
154 hi def link asciidocQuoteBlockDelimiter Type
|
|
155 hi def link asciidocQuotedAttributeList Special
|
|
156 hi def link asciidocQuotedBold Special
|
|
157 hi def link asciidocQuotedDoubleQuoted Label
|
|
158 hi def link asciidocQuotedEmphasized2 Type
|
6180
|
159 hi asciidocQuotedEmphasizedItalic term=italic cterm=italic gui=italic
|
|
160 hi def link asciidocQuotedEmphasized asciidocQuotedEmphasizedItalic
|
4229
|
161 hi def link asciidocQuotedMonospaced2 Identifier
|
|
162 hi def link asciidocQuotedMonospaced Identifier
|
|
163 hi def link asciidocQuotedSingleQuoted Label
|
|
164 hi def link asciidocQuotedSubscript Type
|
|
165 hi def link asciidocQuotedSuperscript Type
|
|
166 hi def link asciidocQuotedUnconstrainedBold Special
|
|
167 hi def link asciidocQuotedUnconstrainedEmphasized Type
|
|
168 hi def link asciidocQuotedUnconstrainedMonospaced Identifier
|
|
169 hi def link asciidocRefMacro Macro
|
|
170 hi def link asciidocRuler Type
|
|
171 hi def link asciidocSidebarDelimiter Type
|
|
172 hi def link asciidocTableBlock2 NONE
|
|
173 hi def link asciidocTableBlock NONE
|
|
174 hi def link asciidocTableDelimiter2 Label
|
|
175 hi def link asciidocTableDelimiter Label
|
|
176 hi def link asciidocTable_OLD Type
|
|
177 hi def link asciidocTablePrefix2 Label
|
|
178 hi def link asciidocTablePrefix Label
|
|
179 hi def link asciidocToDo Todo
|
|
180 hi def link asciidocTriplePlusPassthrough Special
|
|
181 hi def link asciidocTwoLineTitle Title
|
|
182 hi def link asciidocURL Macro
|
|
183 let b:current_syntax = "asciidoc"
|
|
184
|
|
185 " vim: wrap et sw=2 sts=2:
|