4 " Maintainer: Michal Gorny <michal-gorny@wp.pl>
5 " Last_change: 2006-03-23
7 if !exists("main_syntax")
8 if exists("b:current_syntax")
11 let main_syntax = 'svg'
14 if main_syntax == 'svg'
15 runtime! syntax/xml.vim
16 syn cluster xmlTagHook add=svgElement
17 syn cluster xmlAttribHook add=svgAttr
18 syn match xmlDecl /\<\(<?\)\@<=xml\(-stylesheet\)\?\>/ containedin=xmlProcessing contained
19 syn keyword xmlDeclAttr version encoding standalone containedin=xmlProcessing contained
20 syn keyword xmlDeclAttr alternate charset media href title type containedin=xmlProcessing contained
22 syn cluster xhtmlTagHook add=svgElement
23 syn cluster xhtmlAttribHook add=svgAttr
29 syn match svgElement contained /\<svg\>[^:]/me=e-1
30 syn keyword svgElement contained altGlyph altGlyphDef altGlyphItem animate
31 syn keyword svgElement contained animateColor animateMotion animateTransform
32 syn keyword svgElement contained circle clipPath cursor defs desc ellipse
33 syn keyword svgElement contained feBlend feColorMatrix feComponentTransfer
34 syn keyword svgElement contained feComposite feConvolveMatrix feDiffuseLighting
35 syn keyword svgElement contained feDisplacementMap feDistantLight feFlood
36 syn keyword svgElement contained feFuncA feFuncB feFuncG feFuncR feGaussianBlur
37 syn keyword svgElement contained feImage feMerge feMergeNode feMorphology
38 syn keyword svgElement contained feOffset fePointLight feSpecularLighting
39 syn keyword svgElement contained feSpotLight feTile feTurbulence filter
40 syn keyword svgElement contained foreignObject glyph glyphRef hkern image line
41 syn keyword svgElement contained linearGradient marker mask metadata mpath path
42 syn keyword svgElement contained pattern polygon polyline radialGradient rect
43 syn keyword svgElement contained script set stop style switch symbol text
44 syn keyword svgElement contained textPath title tref tspan use view vkern
45 syn match svgElement contained /\<\(font\|font-face\)\>[^-]/me=e-1
46 syn match svgElement contained /\<font-face-\(format\|name\|src\|uri\)\>/
47 syn match svgElement contained /\<\(color-profile\|definition-src\)\>/
48 syn match svgElement contained /\<missing-glyph\>/
49 syn match svgElement contained /\<\(a\|g\)\>[^:]/me=e-1
52 syn keyword svgAttr contained accumulate additive alphabetic amplitude ascent attributeName attributeType azimuth baseFrequency bbox begin bias by
53 syn keyword svgAttr contained calcMode class clipPathUnits contentScriptType contentStyleType cursor cx cy d descent diffuseConstant direction display
54 syn keyword svgAttr contained divisor dur dx dy edgeMode elevation end exponent externalResourcesRequired filter filterRes filterUnits format from fx fy
55 syn keyword svgAttr contained g1 g2 glyphRef gradientTransform gradientUnits hanging height id ideographic in in2 intercept k k1 k2 k3 k4 kernelMatrix
56 syn keyword svgAttr contained kernelUnitLength kerning keyPoints keySplines keyTimes lang lengthAdjust limitingConeAngle local markerHeight markerUnits
57 syn keyword svgAttr contained markerWidth mask maskContentUnits maskUnits mathematical max media method min mode name numOctaves offset opacity operator
58 syn keyword svgAttr contained order orient orientation origin overflow path pathLength patternContentUnits patternTransform patternUnits points pointsAtX
59 syn keyword svgAttr contained pointsAtY pointsAtZ preserveAlpha preserveAspectRatio primitiveUnits r radius refX refY repeatCount repeatDur
60 syn keyword svgAttr contained requiredExtensions requiredFeatures restart result rotate rx ry scale seed slope spacing specularConstant specularExponent
61 syn keyword svgAttr contained spreadMethod startOffset stdDeviation stemh stemv stitchTiles string style surfaceScale systemLanguage tableValues target
62 syn keyword svgAttr contained targetX targetY textLength title to transform type u1 u2 values version viewBox viewTarget visibility width widths x x1 x2
63 syn keyword svgAttr contained xChannelSelector y y1 y2 yChannelSelector z zoomAndPan
64 syn match svgAttr contained /\<xmlns\>[^:]/me=e-1
65 syn match svgAttr contained /\<\(clip\|color\|fill\)\>[^-]/me=e-1
66 syn match svgAttr contained /\<\(stroke\|unicode\)\>[^-]/me=e-1
67 syn match svgAttr contained /\<\(color-interpolation\|font-size\)\>[^-]/me=e-1
68 syn match svgAttr contained /\<\(\accent-height\|alignment-baseline\|arabic-form\|baseline-shift\|cap-height\|clip-\(path\|rule\)\|dominant-baseline\)\>/
69 syn match svgAttr contained /\<\(color-\(interpolation-filters\|profile\|rendering\)\|enable-background\|fill-\(opacity\|rule\)\)\>/
70 syn match svgAttr contained /\<\(flood-\(color\|opacity\)\|font-\(family\|size-adjust\|stretch\|style\|variant\|weight\)\|image-rendering\)\>/
71 syn match svgAttr contained /\<\(glyph-\(name\|orientation-\(horizontal\|vertical\)\)\|horiz-\(adv-x\|origin-\(x\|y\)\)\)\>/
72 syn match svgAttr contained /\<\(letter-spacing\|lighting-color\|marker-\(end\|mid\|start\)\|overline-\(position\|thickness\)\|panose-1\)\>/
73 syn match svgAttr contained /\<\(pointer-events\|rendering-intent\|shape-rendering\|stop-\(color\|opacity\)\|strikethrough-\(position\|thickness\)\)\>/
74 syn match svgAttr contained /\<\(text-\(anchor\|decoration\|rendering\)\|stroke-\(dasharray\|dashoffset\|linecap\|linejoin\|miterlimit\|opacity\|width\)\)\>/
75 syn match svgAttr contained /\<\(underline-\(position\|thickness\)\|unicode-\(bidi\|range\)\|units-per-em\|writing-mode\|x-height\)\>/
76 syn match svgAttr contained /\(vert-\(adv-y\|origin-\(x\|y\)\)\|v-\(alphabetic\|hanging\|ideographic\|mathematical\)\|word-spacing\)\>/
77 syn match svgAttr contained /\<\(xlink:\)\@<=\(actuate\|arcrole\|href\)\>/
78 syn match svgAttr contained /\<\(xlink:\)\@<=\(role\|show\|title\|type\)\>/
79 syn match svgAttr contained /\<\(xml:\)\@<=\(base\|lang\|space\)\>/
80 syn match svgAttr contained /\<\(xmlns:\)\@<=xlink\>/
82 if exists("svg_no_events_rendering")
83 syn match svgEventAttr contained /\<on\(abort\|activate\|begin\|click\|end\|error\|focus\(in\|out\)\|\(un\)\?load\|mouse\(down\|move\|out\|over\|up\)\|repeat\|resize\|scroll\|zoom\)\>/
84 if main_syntax == 'svg'
85 syn cluster xmlAttribHook add=svgEventAttr
87 syn cluster xhtmlAttribHook add=svgEventAttr
91 " Attribute new in SVG 1.1
92 syn keyword svgAttr contained baseProfile
94 " Embedded ECMAScript (JavaScript)
95 if main_syntax == 'svg'
96 syn include @svgJavaScript syntax/javascript.vim
97 unlet b:current_syntax
98 syn region javaScript start=+<script[^>]*[^/]>+ keepend end=+</script>+me=s-1 contains=@svgJavaScript,svgScriptTag
99 syn region svgScriptTag contained start=+<script+ end=+>+ contains=xmlTagName,xmlString,xmlAttrib
102 " Events attributes rendering
103 if !exists("svg_no_events_rendering")
104 syn region svgEvent contained start=+\<on\(abort\|activate\|begin\|click\|end\|error\|focus\(in\|out\)\|\(un\)\?load\|mouse\(down\|move\|out\|over\|up\)\|repeat\|resize\|scroll\|zoom\)\s*=\s*'+ keepend end=+'+ contains=svgEventSQ
105 syn region svgEvent contained start=+\<on\(abort\|activate\|begin\|click\|end\|error\|focus\(in\|out\)\|\(un\)\?load\|mouse\(down\|move\|out\|over\|up\)\|repeat\|resize\|scroll\|zoom\)\s*=\s*"+ keepend end=+"+ contains=svgEventDQ
106 if main_syntax == 'svg'
107 syn cluster xmlAttribHook add=svgEvent
109 syn cluster xhtmlAttribHook add=svgEvent
111 syn region svgEventSQ contained start=+'+ms=s+1 end=+'+me=s-1 contains=@svgJavaScript,@xhtmlJavaScript
112 syn region svgEventDQ contained start=+"+ms=s+1 end=+"+me=s-1 contains=@svgJavaScript,@xhtmlJavaScript
113 hi def link svgEventSQ svgEvent
114 hi def link svgEventDQ svgEvent
118 if !exists("svg_no_rendering")
119 syn region svgTitle start="<title\>" end="</title>"me=e-8 contains=xmlTag,xmlEndTag,xmlEntity,xmlComment
120 syn region svgDesc start="<desc\>" end="</desc>"me=e-8 contains=xmlTag,xmlEndTag,xmlEntity,xmlComment
124 hi link xmlAttrib Function
125 hi def link xmlDecl Statement
126 hi def link xmlDeclAttr Type
127 hi link xmlEntity Special
128 hi link xmlEntityPunct Special
129 hi def link svgElement Statement
130 hi def link svgAttr Type
131 hi def link javaScript Special
132 hi def link svgEvent javaScript
133 hi def link svgEventAttr Type
134 if !exists("svg_no_rendering")
135 hi def link svgTitle Title
136 hi def link svgDesc Title
139 let b:current_syntax = "svg"
141 if main_syntax == 'svg'