nvim/after/syntax/html.vim

80 lines
4.8 KiB
VimL

syn clear htmlArg
syn clear htmlCssDefinition
" css classes
syn region cssClassRegion contained start=+class="+hs=s+7 end=+"+he=e-1 contains=htmlSpecialChar,cssClassAttr,cssAttrNoise,cssClassName containedin=htmlTag,htmlTagN keepend
syn region cssClassRegion contained start=+class='+hs=s+7 end=+'+he=e-1 contains=htmlSpecialChar,cssClassAttr,cssAttrNoise,cssClassName containedin=htmlTag,htmlTagN keepend
syn region cssClassName contained start=+"+hs=s+1 end=+"+he=e-1 contains=cssAttrNoise keepend
syn region cssClassName contained start=+'+hs=s+1 end=+'+he=e-1 contains=cssAttrNoise keepend
syn match cssClassAttr "class" contained
" css IDs
syn region cssIdRegion contained start=+id="+hs=s+4 end=+"+he=e-1 contains=htmlSpecialChar,cssIdentifierAttr,cssAttrNoise,cssIdentifier containedin=htmlTag,htmlTagN keepend
syn region cssIdRegion contained start=+id='+hs=s+4 end=+'+he=e-1 contains=htmlSpecialChar,cssIdentifierAttr,cssAttrNoise,cssIdentifier containedin=htmlTag,htmlTagN keepend
syn region cssIdentifier contained start=+"+hs=s+1 end=+"+he=s-1 contains=cssAttrNoise keepend
syn region cssIdentifier contained start=+'+hs=s+1 end=+'+he=s-1 contains=cssAttrNoise keepend
syn match cssIdentifierAttr "id" contained
" img arguments
syn region htmlArgRegion contained start=+src="+hs=s+5 end=+"+he=e-1 contains=htmlSpecialChar,cssAttrNoise,htmlSrcArg,htmlSrcValue containedin=htmlTag,htmlTagN keepend
syn region htmlArgRegion contained start=+src='+hs=s+5 end=+'+he=e-1 contains=htmlSpecialChar,cssAttrNoise,htmlSrcArg,htmlSrcValue containedin=htmlTag,htmlTagN keepend
syn region htmlSrcValue contained start=+"+hs=s+1 end=+"+he=s-1 contains=cssAttrNoise keepend
syn region htmlSrcValue contained start=+'+hs=s+1 end=+'+he=s-1 contains=cssAttrNoise keepend
syn match htmlSrcArg "src" contained
syn region htmlArgRegion contained start=+srcset="+hs=s+8 end=+"+he=e-1 contains=htmlSpecialChar,htmlSrcsetArg,htmlSrcsetValue,cssAttrNoise containedin=htmlTag,htmlTagN keepend
syn region htmlArgRegion contained start=+srcset='+hs=s+8 end=+'+he=e-1 contains=htmlSpecialChar,htmlSrcsetArg,htmlSrcsetValue,cssAttrNoise containedin=htmlTag,htmlTagN keepend
syn region htmlSrcsetValue contained start=+"+hs=s+1 end=+"+he=s-1 contains=cssAttrNoise keepend
syn region htmlSrcsetValue contained start=+'+hs=s+1 end=+'+he=s-1 contains=cssAttrNoise keepend
syn match htmlSrcsetArg "srcset" contained
syn region htmlArgRegion contained start=+\<alt="+hs=s+5 end=+"+he=e-1 contains=htmlSpecialChar,htmlAltArg,htmlAltValue,cssAttrNoise containedin=htmlTag,htmlTagN keepend
syn region htmlArgRegion contained start=+\<alt='+hs=s+5 end=+'+he=e-1 contains=htmlSpecialChar,htmlAltArg,htmlAltValue,cssAttrNoise containedin=htmlTag,htmlTagN keepend
syn region htmlAltValue contained start=+"+hs=s+1 end=+"+he=s-1 contains=cssAttrNoise keepend
syn region htmlAltValue contained start=+'+hs=s+1 end=+'+he=s-1 contains=cssAttrNoise keepend
syn match htmlAltArg "alt" contained
" data-*
syn region htmlArgRegion contained start=+data.*="+ end=+"+ contains=htmlDataArg,htmlDataValue,cssAttrNoise,htmlTag containedin=htmlTag,htmlTagN keepend
syn region htmlArgRegion contained start=+data.*='+ end=+'+ contains=htmlDataArg,htmlDataValue,cssAttrNoise,htmlTag containedin=htmlTag,htmlTagN keepend
syn region htmlDataValue contained start=+"+hs=s+1 end=+"+me=e-1 contains=cssAttrNoise keepend
syn region htmlDataValue contained start=+'+hs=s+1 end=+'+me=e-1 contains=cssAttrNoise keepend
syn match htmlDataArg +data.*="+me=e-2 contained
" href
syn region htmlArgRegion contained start=+href="+hs=s+7 end=+"+he=e-1 contains=htmlSpecialChar,htmlHrefArg,htmlHrefValue,cssAttrNoise containedin=htmlTag,htmlTagN keepend
syn region htmlArgRegion contained start=+href='+hs=s+7 end=+'+he=e-1 contains=htmlSpecialChar,htmlHrefArg,htmlHrefValue,cssAttrNoise containedin=htmlTag,htmlTagN keepend
syn region htmlHrefValue contained start=+"+hs=s+1 end=+"+he=s-1 contains=cssAttrNoise keepend
syn region htmlHrefValue contained start=+'+hs=s+1 end=+'+he=s-1 contains=cssAttrNoise keepend
syn match htmlHrefArg "href" contained
syn match cssAttrNoise +=+ contained
syn region htmlLink start="<a\>\_[^>]*\<href\>" end="</a>"me=e-4 contains=@Spell,htmlTag,htmlEndTag,htmlSpecialChar,htmlPreProc,htmlComment,htmlLeadingSpace,javaScript,@htmlPreproc,htmlArgRegion
"TODO better group links
hi def link cssAttrNoise htmlTag
hi def link cssClassName Identifier
hi def link cssClassAttr Type
hi def link cssIdentifier Identifier
hi def link cssIdentifierAttr Type
hi def link htmlSrcValue htmlImgValue
hi def link htmlSrcArg htmlImgArg
hi def link htmlSrcsetValue htmlImgValue
hi def link htmlSrcsetArg htmlImgArg
hi def link htmlAltValue htmlImgValue
hi def link htmlAltArg htmlImgArg
hi def link htmlImgValue Identifier
hi def link htmlImgArg Type
hi def link htmlDataValue Identifier
hi def link htmlDataArg Special
hi def link htmlHrefValue Identifier
hi def link htmlHrefArg Type