tidying up code

This commit is contained in:
ManjaroOne666 2017-09-14 12:35:04 +01:00
parent 89c45302e1
commit e1ccadd642
1 changed files with 22 additions and 16 deletions

View File

@ -26,7 +26,6 @@ syn case ignore
" mark illegal characters " mark illegal characters
syn match htmlError "[<>&]" syn match htmlError "[<>&]"
syn region htmlString contained start=+"+ end=+"+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc keepend syn region htmlString contained start=+"+ end=+"+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc keepend
syn region htmlString contained start=+'+ end=+'+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc keepend syn region htmlString contained start=+'+ end=+'+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc keepend
@ -34,46 +33,53 @@ syn region htmlString contained start=+'+ end=+'+ contains=htmlSpecialChar,ja
syn region cssClassRegion contained start=+class="+hs=s+7 end=+"+he=e-1 contains=htmlSpecialChar,cssClassAttr,cssAttrNoise,cssClassName keepend syn region cssClassRegion contained start=+class="+hs=s+7 end=+"+he=e-1 contains=htmlSpecialChar,cssClassAttr,cssAttrNoise,cssClassName keepend
syn region cssClassRegion contained start=+class='+hs=s+7 end=+'+he=e-1 contains=htmlSpecialChar,cssClassAttr,cssAttrNoise,cssClassName keepend syn region cssClassRegion contained start=+class='+hs=s+7 end=+'+he=e-1 contains=htmlSpecialChar,cssClassAttr,cssAttrNoise,cssClassName 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 region cssClassName contained start=+'+hs=s+1 end=+'+he=e-1 contains=cssAttrNoise keepend
syn match cssClassAttr "class" contained syn match cssClassAttr "class" contained
" css IDs " css IDs
syn region cssIdRegion contained start=+id="+hs=s+4 end=+"+he=e-1 contains=htmlSpecialChar,cssIdentifierAttr,cssAttrNoise,cssIdentifier keepend syn region cssIdRegion contained start=+id="+hs=s+4 end=+"+he=e-1 contains=htmlSpecialChar,cssIdentifierAttr,cssAttrNoise,cssIdentifier keepend
syn region cssIdRegion contained start=+id='+hs=s+4 end=+'+he=e-1 contains=htmlSpecialChar,cssIdentifierAttr,cssAttrNoise,cssIdentifier keepend syn region cssIdRegion contained start=+id='+hs=s+4 end=+'+he=e-1 contains=htmlSpecialChar,cssIdentifierAttr,cssAttrNoise,cssIdentifier 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 region cssIdentifier contained start=+'+hs=s+1 end=+'+he=s-1 contains=cssAttrNoise keepend
syn match cssIdentifierAttr "id" contained syn match cssIdentifierAttr "id" contained
" img arguments " img arguments
syn region htmlArgRegion contained start=+src="+hs=s+5 end=+"+he=e-1 contains=htmlSpecialChar,cssAttrNoise,htmlSrcArg,htmlSrcValue keepend syn region htmlArgRegion contained start=+src="+hs=s+5 end=+"+he=e-1 contains=htmlSpecialChar,cssAttrNoise,htmlSrcArg,htmlSrcValue keepend
syn region htmlArgRegion contained start=+src='+hs=s+5 end=+'+he=e-1 contains=htmlSpecialChar,cssAttrNoise,htmlSrcArg,htmlSrcValue keepend syn region htmlArgRegion contained start=+src='+hs=s+5 end=+'+he=e-1 contains=htmlSpecialChar,cssAttrNoise,htmlSrcArg,htmlSrcValue 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 region htmlSrcValue contained start=+'+hs=s+1 end=+'+he=s-1 contains=cssAttrNoise keepend
syn match htmlSrcArg "src" contained syn match htmlSrcArg "src" contained
syn region htmlArgRegion contained start=+srcset="+hs=s+8 end=+"+he=e-1 contains=htmlSpecialChar,htmlSrcsetArg,htmlSrcsetValue,cssAttrNoise keepend syn region htmlArgRegion contained start=+srcset="+hs=s+8 end=+"+he=e-1 contains=htmlSpecialChar,htmlSrcsetArg,htmlSrcsetValue,cssAttrNoise keepend
syn region htmlArgRegion contained start=+srcset='+hs=s+8 end=+'+he=e-1 contains=htmlSpecialChar,htmlSrcsetArg,htmlSrcsetValue,cssAttrNoise keepend syn region htmlArgRegion contained start=+srcset='+hs=s+8 end=+'+he=e-1 contains=htmlSpecialChar,htmlSrcsetArg,htmlSrcsetValue,cssAttrNoise 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 region htmlSrcsetValue contained start=+'+hs=s+1 end=+'+he=s-1 contains=cssAttrNoise keepend
syn match htmlSrcsetArg "srcset" contained syn match htmlSrcsetArg "srcset" contained
syn region htmlArgRegion contained start=+alt="+hs=s+5 end=+"+he=e-1 contains=htmlSpecialChar,htmlAltArg,htmlAltValue,cssAttrNoise keepend syn region htmlArgRegion contained start=+alt="+hs=s+5 end=+"+he=e-1 contains=htmlSpecialChar,htmlAltArg,htmlAltValue,cssAttrNoise keepend
syn region htmlArgRegion contained start=+alt='+hs=s+5 end=+'+he=e-1 contains=htmlSpecialChar,htmlAltArg,htmlAltValue,cssAttrNoise keepend syn region htmlArgRegion contained start=+alt='+hs=s+5 end=+'+he=e-1 contains=htmlSpecialChar,htmlAltArg,htmlAltValue,cssAttrNoise 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 region htmlAltValue contained start=+'+hs=s+1 end=+'+he=s-1 contains=cssAttrNoise keepend
syn match htmlAltArg "alt" contained syn match htmlAltArg "alt" contained
" data-* " data-*
syn region htmlArgRegion contained start=+data.*="+hs=s+5 end=+"+ contains=htmlDataArg,htmlDataValue,cssAttrNoise keepend syn region htmlArgRegion contained start=+data.*="+ end=+"+ contains=htmlDataArg,htmlDataValue,cssAttrNoise,htmlTag keepend
"syn region htmlArgRegion contained start=+alt='+hs=s+5 end=+'+he=e-1 contains=htmlSpecialChar,htmlAltArg,htmlAltValue,cssAttrNoise keepend syn region htmlArgRegion contained start=+data.*='+ end=+'+ contains=htmlDataArg,htmlDataValue,cssAttrNoise,htmlTag 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 region htmlDataValue contained start=+'+hs=s+1 end=+'+me=e-1 contains=cssAttrNoise keepend
syn match htmlDataArg +data.*="+me=e-2 contained syn match htmlDataArg +data.*="+me=e-2 contained
hi htmlDataValue ctermfg=163
hi htmlDataArg ctermfg=56
" href
syn region htmlArgRegion contained start=+href="+hs=s+7 end=+"+he=e-1 contains=htmlSpecialChar,htmlHrefArg,htmlHrefValue,cssAttrNoise keepend
syn region htmlArgRegion contained start=+href='+hs=s+7 end=+'+he=e-1 contains=htmlSpecialChar,htmlHrefArg,htmlHrefValue,cssAttrNoise 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 match cssAttrNoise +=+ contained
"TODO better group links
hi def link cssAttrNoise htmlTag hi def link cssAttrNoise htmlTag
" TODO better linking groups
hi def link cssClassName Identifier hi def link cssClassName Identifier
hi def link cssClassAttr Type hi def link cssClassAttr Type
hi def link cssIdentifier Identifier hi def link cssIdentifier Identifier
@ -88,11 +94,10 @@ hi def link htmlImgValue Identifier
hi def link htmlImgArg Type hi def link htmlImgArg Type
hi def link htmlDataValue Identifier hi def link htmlDataValue Identifier
hi def link htmlDataArg Special hi def link htmlDataArg Special
hi def link htmlHrefValue Identifier
hi def link htmlHrefArg Type
syn region htmlIdString contained start=+id="+ end=+"+ contains=htmlSpecialChar
syn region htmlIdString contained start=+id='+ end=+'+ contains=htmlSpecialChar
syn match htmlValue contained "=[\t ]*[^'" \t>][^ \t>]*"hs=s+1 contains=javaScriptExpression,@htmlPreproc syn match htmlValue contained "=[\t ]*[^'" \t>][^ \t>]*"hs=s+1 contains=javaScriptExpression,@htmlPreproc
syn region htmlEndTag start=+</+ end=+>+ contains=htmlTagN,htmlTagError syn region htmlEndTag start=+</+ end=+>+ contains=htmlTagN,htmlTagError
syn region htmlTag start=+<[^/]+ end=+>+ fold contains=htmlTagN,htmlString,cssClassRegion,cssIdRegion,htmlArgregion,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster syn region htmlTag start=+<[^/]+ end=+>+ fold contains=htmlTagN,htmlString,cssClassRegion,cssIdRegion,htmlArgregion,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster
@ -137,7 +142,8 @@ syn keyword htmlArg contained marginwidth maxlength method name prompt
syn keyword htmlArg contained rel rev rows rowspan scrolling selected shape syn keyword htmlArg contained rel rev rows rowspan scrolling selected shape
syn keyword htmlArg contained size start target text type url syn keyword htmlArg contained size start target text type url
syn keyword htmlArg contained usemap ismap valign value vlink vspace width wrap syn keyword htmlArg contained usemap ismap valign value vlink vspace width wrap
syn match htmlArg contained "\<\(http-equiv\|href\|title\)="me=e-1 "syn match htmlArg contained "\<\(http-equiv\|href\|title\)="me=e-1
syn match htmlArg contained "\<\(http-equiv\|title\)="me=e-1
" Netscape extensions " Netscape extensions
syn keyword htmlTagName contained frame noframes frameset nobr blink syn keyword htmlTagName contained frame noframes frameset nobr blink
@ -229,7 +235,7 @@ if !exists("html_no_rendering")
syn region htmlItalicUnderlineBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop syn region htmlItalicUnderlineBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop
syn match htmlLeadingSpace "^\s\+" contained syn match htmlLeadingSpace "^\s\+" contained
syn region htmlLink start="<a\>\_[^>]*\<href\>" end="</a>"me=e-4 contains=@Spell,htmlTag,htmlEndTag,htmlSpecialChar,htmlPreProc,htmlComment,htmlLeadingSpace,javaScript,@htmlPreproc syn region htmlLink start="<a\>\_[^>]*\<href\>" end="</a>"me=e-4 contains=@Spell,htmlTag,htmlEndTag,htmlSpecialChar,htmlPreProc,htmlComment,htmlLeadingSpace,javaScript,@htmlPreproc,htmlArgRegion
syn region htmlH1 start="<h1\>" end="</h1>"me=e-5 contains=@htmlTop syn region htmlH1 start="<h1\>" end="</h1>"me=e-5 contains=@htmlTop
syn region htmlH2 start="<h2\>" end="</h2>"me=e-5 contains=@htmlTop syn region htmlH2 start="<h2\>" end="</h2>"me=e-5 contains=@htmlTop
syn region htmlH3 start="<h3\>" end="</h3>"me=e-5 contains=@htmlTop syn region htmlH3 start="<h3\>" end="</h3>"me=e-5 contains=@htmlTop
@ -246,8 +252,8 @@ if main_syntax != 'java' || exists("java_javascript")
" JAVA SCRIPT " JAVA SCRIPT
syn include @htmlJavaScript syntax/javascript.vim syn include @htmlJavaScript syntax/javascript.vim
unlet b:current_syntax unlet b:current_syntax
syn region javaScript start=+<script\_[^>]*>+ keepend end=+</script\_[^>]*>+me=s-1 contains=@htmlJavaScript,htmlCssStyleComment,htmlScriptTag,@htmlPreproc syn region javaScript start=+<script\_[^>]*>+hs=s+1 keepend end=+</script\_[^>]*>+me=s-1 contains=@htmlJavaScript,htmlCssStyleComment,htmlScriptTag,@htmlPreproc
syn region htmlScriptTag contained start=+<script+ end=+>+ fold contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent syn region htmlScriptTag contained start=+<script+hs=s+1 end=+>+ fold contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent
hi def link htmlScriptTag htmlTag hi def link htmlScriptTag htmlTag
" html events (i.e. arguments that include javascript commands) " html events (i.e. arguments that include javascript commands)