vim-patch:a9058440b7b9

runtime(html): Update syntax file (vim/vim#13591)

Add missing search element and update ARIA attribute list.

Add a very basic test file to check all elements are matched.

a9058440b7

Co-authored-by: dkearns <dougkearns@gmail.com>
This commit is contained in:
Christian Clason 2023-11-28 23:35:40 +01:00
parent 4a8bf24ac6
commit 8594b0858f
1 changed files with 71 additions and 19 deletions

View File

@ -3,9 +3,9 @@
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainers: Jorge Maldonado Ventura <jorgesumle@freakspot.net>
" Claudio Fleiner <claudio@fleiner.com>
" Last Change: 2023 Feb 20
" Last Change: 2023 Nov 28
" Please check :help html.vim for some comments and a description of the options
" See :help html.vim for some comments and a description of the options
" quit when a syntax file was already loaded
if !exists("main_syntax")
@ -28,7 +28,6 @@ syn case ignore
" mark illegal characters
syn match htmlError "[<>&]"
" tags
syn region htmlString contained start=+"+ end=+"+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc
syn region htmlString contained start=+'+ end=+'+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc
@ -39,7 +38,6 @@ syn match htmlTagN contained +<\s*[-a-zA-Z0-9]\++hs=s+1 contains=htmlTagName,
syn match htmlTagN contained +</\s*[-a-zA-Z0-9]\++hs=s+2 contains=htmlTagName,htmlSpecialTagName,@htmlTagNameCluster
syn match htmlTagError contained "[^>]<"ms=s+1
" tag names
syn keyword htmlTagName contained address applet area a base basefont
syn keyword htmlTagName contained big blockquote br caption center
@ -61,7 +59,7 @@ syn keyword htmlTagName contained article aside audio bdi canvas data
syn keyword htmlTagName contained datalist details dialog embed figcaption
syn keyword htmlTagName contained figure footer header hgroup keygen main
syn keyword htmlTagName contained mark menuitem meter nav output picture
syn keyword htmlTagName contained progress rb rp rt rtc ruby section
syn keyword htmlTagName contained progress rb rp rt rtc ruby search section
syn keyword htmlTagName contained slot source summary template time track
syn keyword htmlTagName contained video wbr
@ -88,19 +86,72 @@ syn keyword htmlArg contained size src start target text type url
syn keyword htmlArg contained usemap ismap valign value vlink vspace width wrap
syn match htmlArg contained "\<\%(http-equiv\|href\|title\)="me=e-1
" aria attributes
exe 'syn match htmlArg contained "\<aria-\%(' . join([
\ 'activedescendant', 'atomic', 'autocomplete', 'busy', 'checked', 'colcount',
\ 'colindex', 'colspan', 'controls', 'current', 'describedby', 'details',
\ 'disabled', 'dropeffect', 'errormessage', 'expanded', 'flowto', 'grabbed',
\ 'haspopup', 'hidden', 'invalid', 'keyshortcuts', 'label', 'labelledby', 'level',
\ 'live', 'modal', 'multiline', 'multiselectable', 'orientation', 'owns',
\ 'placeholder', 'posinset', 'pressed', 'readonly', 'relevant', 'required',
\ 'roledescription', 'rowcount', 'rowindex', 'rowspan', 'selected', 'setsize',
\ 'sort', 'valuemax', 'valuemin', 'valuenow', 'valuetext'
\ ], '\|') . '\)\>"'
syn keyword htmlArg contained role
" ARIA attributes {{{1
let s:aria =<< trim END
activedescendant
atomic
autocomplete
braillelabel
brailleroledescription
busy
checked
colcount
colindex
colindextext
colspan
controls
current
describedby
description
details
disabled
errormessage
expanded
flowto
haspopup
hidden
invalid
keyshortcuts
label
labelledby
level
live
modal
multiline
multiselectable
orientation
owns
placeholder
posinset
pressed
readonly
relevant
required
roledescription
rowcount
rowindex
rowindextext
rowspan
selected
setsize
sort
valuemax
valuemin
valuenow
valuetext
END
let s:aria_deprecated =<< trim END
dropeffect
grabbed
END
call extend(s:aria, s:aria_deprecated)
exe 'syn match htmlArg contained "\%#=1\<aria-\%(' .. s:aria->join('\|') .. '\)\>"'
unlet s:aria s:aria_deprecated
" }}}
" Netscape extensions
syn keyword htmlTagName contained frame noframes frameset nobr blink
syn keyword htmlTagName contained layer ilayer nolayer spacer
@ -321,9 +372,9 @@ if !exists("html_no_rendering")
hi def htmlUnderlineItalic term=italic,underline cterm=italic,underline gui=italic,underline
hi def htmlItalic term=italic cterm=italic gui=italic
if v:version > 800 || v:version == 800 && has("patch1038")
hi def htmlStrike term=strikethrough cterm=strikethrough gui=strikethrough
hi def htmlStrike term=strikethrough cterm=strikethrough gui=strikethrough
else
hi def htmlStrike term=underline cterm=underline gui=underline
hi def htmlStrike term=underline cterm=underline gui=underline
endif
endif
endif
@ -356,4 +407,5 @@ endif
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: ts=8
" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker: