Mercurial > vim
comparison runtime/syntax/html.vim @ 33846:bc2505818986
runtime(html): Update syntax file (#13591)
Commit: https://github.com/vim/vim/commit/a9058440b7b9d7f5d0027c8cd44366e9200ca241
Author: dkearns <dougkearns@gmail.com>
Date: Wed Nov 29 06:41:41 2023 +1100
runtime(html): Update syntax file (https://github.com/vim/vim/issues/13591)
Add missing search element and update ARIA attribute list.
Add a very basic test file to check all elements are matched.
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 28 Nov 2023 20:45:07 +0100 |
parents | a9b5ffbc0428 |
children |
comparison
equal
deleted
inserted
replaced
33845:25c6d44f2583 | 33846:bc2505818986 |
---|---|
1 " Vim syntax file | 1 " Vim syntax file |
2 " Language: HTML | 2 " Language: HTML |
3 " Maintainer: Doug Kearns <dougkearns@gmail.com> | 3 " Maintainer: Doug Kearns <dougkearns@gmail.com> |
4 " Previous Maintainers: Jorge Maldonado Ventura <jorgesumle@freakspot.net> | 4 " Previous Maintainers: Jorge Maldonado Ventura <jorgesumle@freakspot.net> |
5 " Claudio Fleiner <claudio@fleiner.com> | 5 " Claudio Fleiner <claudio@fleiner.com> |
6 " Last Change: 2023 Feb 20 | 6 " Last Change: 2023 Nov 28 |
7 | 7 |
8 " Please check :help html.vim for some comments and a description of the options | 8 " See :help html.vim for some comments and a description of the options |
9 | 9 |
10 " quit when a syntax file was already loaded | 10 " quit when a syntax file was already loaded |
11 if !exists("main_syntax") | 11 if !exists("main_syntax") |
12 if exists("b:current_syntax") | 12 if exists("b:current_syntax") |
13 finish | 13 finish |
25 | 25 |
26 syn case ignore | 26 syn case ignore |
27 | 27 |
28 " mark illegal characters | 28 " mark illegal characters |
29 syn match htmlError "[<>&]" | 29 syn match htmlError "[<>&]" |
30 | |
31 | 30 |
32 " tags | 31 " tags |
33 syn region htmlString contained start=+"+ end=+"+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc | 32 syn region htmlString contained start=+"+ end=+"+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc |
34 syn region htmlString contained start=+'+ end=+'+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc | 33 syn region htmlString contained start=+'+ end=+'+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc |
35 syn match htmlValue contained "=[\t ]*[^'" \t>][^ \t>]*"hs=s+1 contains=javaScriptExpression,@htmlPreproc | 34 syn match htmlValue contained "=[\t ]*[^'" \t>][^ \t>]*"hs=s+1 contains=javaScriptExpression,@htmlPreproc |
36 syn region htmlEndTag start=+</+ end=+>+ contains=htmlTagN,htmlTagError | 35 syn region htmlEndTag start=+</+ end=+>+ contains=htmlTagN,htmlTagError |
37 syn region htmlTag start=+<[^/]+ end=+>+ fold contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster | 36 syn region htmlTag start=+<[^/]+ end=+>+ fold contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster |
38 syn match htmlTagN contained +<\s*[-a-zA-Z0-9]\++hs=s+1 contains=htmlTagName,htmlSpecialTagName,@htmlTagNameCluster | 37 syn match htmlTagN contained +<\s*[-a-zA-Z0-9]\++hs=s+1 contains=htmlTagName,htmlSpecialTagName,@htmlTagNameCluster |
39 syn match htmlTagN contained +</\s*[-a-zA-Z0-9]\++hs=s+2 contains=htmlTagName,htmlSpecialTagName,@htmlTagNameCluster | 38 syn match htmlTagN contained +</\s*[-a-zA-Z0-9]\++hs=s+2 contains=htmlTagName,htmlSpecialTagName,@htmlTagNameCluster |
40 syn match htmlTagError contained "[^>]<"ms=s+1 | 39 syn match htmlTagError contained "[^>]<"ms=s+1 |
41 | |
42 | 40 |
43 " tag names | 41 " tag names |
44 syn keyword htmlTagName contained address applet area a base basefont | 42 syn keyword htmlTagName contained address applet area a base basefont |
45 syn keyword htmlTagName contained big blockquote br caption center | 43 syn keyword htmlTagName contained big blockquote br caption center |
46 syn keyword htmlTagName contained cite code dd dfn dir div dl dt font | 44 syn keyword htmlTagName contained cite code dd dfn dir div dl dt font |
59 " new html 5 tags | 57 " new html 5 tags |
60 syn keyword htmlTagName contained article aside audio bdi canvas data | 58 syn keyword htmlTagName contained article aside audio bdi canvas data |
61 syn keyword htmlTagName contained datalist details dialog embed figcaption | 59 syn keyword htmlTagName contained datalist details dialog embed figcaption |
62 syn keyword htmlTagName contained figure footer header hgroup keygen main | 60 syn keyword htmlTagName contained figure footer header hgroup keygen main |
63 syn keyword htmlTagName contained mark menuitem meter nav output picture | 61 syn keyword htmlTagName contained mark menuitem meter nav output picture |
64 syn keyword htmlTagName contained progress rb rp rt rtc ruby section | 62 syn keyword htmlTagName contained progress rb rp rt rtc ruby search section |
65 syn keyword htmlTagName contained slot source summary template time track | 63 syn keyword htmlTagName contained slot source summary template time track |
66 syn keyword htmlTagName contained video wbr | 64 syn keyword htmlTagName contained video wbr |
67 | 65 |
68 " svg and math tags | 66 " svg and math tags |
69 syn keyword htmlMathTagName contained math | 67 syn keyword htmlMathTagName contained math |
86 syn keyword htmlArg contained rel rev rows rowspan scrolling selected shape | 84 syn keyword htmlArg contained rel rev rows rowspan scrolling selected shape |
87 syn keyword htmlArg contained size src start target text type url | 85 syn keyword htmlArg contained size src start target text type url |
88 syn keyword htmlArg contained usemap ismap valign value vlink vspace width wrap | 86 syn keyword htmlArg contained usemap ismap valign value vlink vspace width wrap |
89 syn match htmlArg contained "\<\%(http-equiv\|href\|title\)="me=e-1 | 87 syn match htmlArg contained "\<\%(http-equiv\|href\|title\)="me=e-1 |
90 | 88 |
91 " aria attributes | |
92 exe 'syn match htmlArg contained "\<aria-\%(' . join([ | |
93 \ 'activedescendant', 'atomic', 'autocomplete', 'busy', 'checked', 'colcount', | |
94 \ 'colindex', 'colspan', 'controls', 'current', 'describedby', 'details', | |
95 \ 'disabled', 'dropeffect', 'errormessage', 'expanded', 'flowto', 'grabbed', | |
96 \ 'haspopup', 'hidden', 'invalid', 'keyshortcuts', 'label', 'labelledby', 'level', | |
97 \ 'live', 'modal', 'multiline', 'multiselectable', 'orientation', 'owns', | |
98 \ 'placeholder', 'posinset', 'pressed', 'readonly', 'relevant', 'required', | |
99 \ 'roledescription', 'rowcount', 'rowindex', 'rowspan', 'selected', 'setsize', | |
100 \ 'sort', 'valuemax', 'valuemin', 'valuenow', 'valuetext' | |
101 \ ], '\|') . '\)\>"' | |
102 syn keyword htmlArg contained role | 89 syn keyword htmlArg contained role |
90 | |
91 " ARIA attributes {{{1 | |
92 let s:aria =<< trim END | |
93 activedescendant | |
94 atomic | |
95 autocomplete | |
96 braillelabel | |
97 brailleroledescription | |
98 busy | |
99 checked | |
100 colcount | |
101 colindex | |
102 colindextext | |
103 colspan | |
104 controls | |
105 current | |
106 describedby | |
107 description | |
108 details | |
109 disabled | |
110 errormessage | |
111 expanded | |
112 flowto | |
113 haspopup | |
114 hidden | |
115 invalid | |
116 keyshortcuts | |
117 label | |
118 labelledby | |
119 level | |
120 live | |
121 modal | |
122 multiline | |
123 multiselectable | |
124 orientation | |
125 owns | |
126 placeholder | |
127 posinset | |
128 pressed | |
129 readonly | |
130 relevant | |
131 required | |
132 roledescription | |
133 rowcount | |
134 rowindex | |
135 rowindextext | |
136 rowspan | |
137 selected | |
138 setsize | |
139 sort | |
140 valuemax | |
141 valuemin | |
142 valuenow | |
143 valuetext | |
144 END | |
145 let s:aria_deprecated =<< trim END | |
146 dropeffect | |
147 grabbed | |
148 END | |
149 | |
150 call extend(s:aria, s:aria_deprecated) | |
151 exe 'syn match htmlArg contained "\%#=1\<aria-\%(' .. s:aria->join('\|') .. '\)\>"' | |
152 unlet s:aria s:aria_deprecated | |
153 " }}} | |
103 | 154 |
104 " Netscape extensions | 155 " Netscape extensions |
105 syn keyword htmlTagName contained frame noframes frameset nobr blink | 156 syn keyword htmlTagName contained frame noframes frameset nobr blink |
106 syn keyword htmlTagName contained layer ilayer nolayer spacer | 157 syn keyword htmlTagName contained layer ilayer nolayer spacer |
107 syn keyword htmlArg contained frameborder noresize pagex pagey above below | 158 syn keyword htmlArg contained frameborder noresize pagex pagey above below |
319 hi def htmlBoldUnderlineItalic term=bold,italic,underline cterm=bold,italic,underline gui=bold,italic,underline | 370 hi def htmlBoldUnderlineItalic term=bold,italic,underline cterm=bold,italic,underline gui=bold,italic,underline |
320 hi def htmlUnderline term=underline cterm=underline gui=underline | 371 hi def htmlUnderline term=underline cterm=underline gui=underline |
321 hi def htmlUnderlineItalic term=italic,underline cterm=italic,underline gui=italic,underline | 372 hi def htmlUnderlineItalic term=italic,underline cterm=italic,underline gui=italic,underline |
322 hi def htmlItalic term=italic cterm=italic gui=italic | 373 hi def htmlItalic term=italic cterm=italic gui=italic |
323 if v:version > 800 || v:version == 800 && has("patch1038") | 374 if v:version > 800 || v:version == 800 && has("patch1038") |
324 hi def htmlStrike term=strikethrough cterm=strikethrough gui=strikethrough | 375 hi def htmlStrike term=strikethrough cterm=strikethrough gui=strikethrough |
325 else | 376 else |
326 hi def htmlStrike term=underline cterm=underline gui=underline | 377 hi def htmlStrike term=underline cterm=underline gui=underline |
327 endif | 378 endif |
328 endif | 379 endif |
329 endif | 380 endif |
330 | 381 |
331 hi def link htmlPreStmt PreProc | 382 hi def link htmlPreStmt PreProc |
354 unlet main_syntax | 405 unlet main_syntax |
355 endif | 406 endif |
356 | 407 |
357 let &cpo = s:cpo_save | 408 let &cpo = s:cpo_save |
358 unlet s:cpo_save | 409 unlet s:cpo_save |
359 " vim: ts=8 | 410 |
411 " vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker: |