Skip to content

Commit 7baa11d

Browse files
authored
Merge pull request #48 from hail2u/svg2
Support SVG 2 elements and attributes
2 parents d6644dd + 33ff4c1 commit 7baa11d

File tree

4 files changed

+231
-0
lines changed

4 files changed

+231
-0
lines changed

after/syntax/css/svg2.vim

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
syn keyword cssTagName animate animateMotion animateTransform circle clipPath cursor defs desc discard ellipse feBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap feDistantLight feDropShadow feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur feImage feMerge feMergeNode feMorphology feOffset fePointLight feSpecularLighting feSpotLight feTile feTurbulence filter foreignObject g hatch hatchpath image line linearGradient marker mesh meshgradient meshpatch meshrow metadata mpath path pattern polygon polyline radialGradient rect set solidcolor stop switch symbol text textPath tspan unknown use view
2+
3+
syn keyword cssFontProp contained cx cy d r rx ry x y
4+
syn match cssFontProp contained "\<color-\(interpolation\|rendering\)\>"
5+
syn match cssFontProp contained "\<fill\(-\(opacity\|rule\)\)\=\>"
6+
syn match cssFontProp contained "\<image-rendering\>"
7+
syn match cssFontProp contained "\<marker-\(end\|mid\|start\)\>"
8+
syn match cssFontProp contained "\<pointer-events\>"
9+
syn match cssFontProp contained "\<shape-rendering\>"
10+
syn match cssFontProp contained "\<solid-\(color\|opacity\)\>"
11+
syn match cssFontProp contained "\<stop-\(color\|opacity\)\>"
12+
syn match cssFontProp contained "\<stroke\(-\(dash\(array\|offset\)\|line\(cap\|join\)\|miterlimit\|opacity\|width\)\)\=\>"
13+
syn match cssFontProp contained "\<text-anchor\>"
14+
syn match cssFontProp contained "\<vector-effect\>"
15+
16+
syn keyword cssFontAttr contained arcs butt crispEdges geometricPrecision optimizeQuality painted stroke viewport visibleFill visiblePainted visibleStroke
17+
syn match cssFontAttr contained "\<bounding-box\>"
18+
syn match cssFontAttr contained "\<context-\(fill\|stroke\)\>"
19+
syn match cssFontAttr contained "\<fixed-position\>"
20+
syn match cssFontAttr contained "\<miter\(-clip\)\=\>"
21+
syn match cssFontAttr contained "\<non-\(scaling-stroke\|scaling-size\|rotation\)\>"
22+
23+
syn region cssFunction contained matchgroup=cssFunctionName start="\<\(child\|icc-color\)\s*(" end=")" oneline keepend

after/syntax/html.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,6 @@ syn include @htmlCss syntax/css/pointerevents.vim
6565
syn include @htmlCss syntax/css/selectors-nonelement-1.vim
6666
syn include @htmlCss syntax/css/selectors.vim
6767
syn include @htmlCss syntax/css/selectors4.vim
68+
syn include @htmlCss syntax/css/svg2.vim
6869
syn include @htmlCss syntax/css/web-animations-1.vim
6970
syn include @htmlCss syntax/css/worklets-1.vim

test/test.css

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,3 +760,106 @@ rtc,
760760
template {
761761
display: auto;
762762
}
763+
764+
.svg2,
765+
animate,
766+
animateMotion,
767+
animateTransform,
768+
circle,
769+
clipPath,
770+
cursor,
771+
defs,
772+
desc,
773+
discard,
774+
ellipse,
775+
feBlend,
776+
feColorMatrix,
777+
feComponentTransfer,
778+
feComposite,
779+
feConvolveMatrix,
780+
feDiffuseLighting,
781+
feDisplacementMap,
782+
feDistantLight,
783+
feDropShadow,
784+
feFlood,
785+
feFuncA,
786+
feFuncB,
787+
feFuncG,
788+
feFuncR,
789+
feGaussianBlur,
790+
feImage,
791+
feMerge,
792+
feMergeNode,
793+
feMorphology,
794+
feOffset,
795+
fePointLight,
796+
feSpecularLighting,
797+
feSpotLight,
798+
feTile,
799+
feTurbulence,
800+
filter,
801+
foreignObject,
802+
g,
803+
hatch,
804+
hatchpath,
805+
image,
806+
line,
807+
linearGradient,
808+
marker,
809+
mesh,
810+
meshgradient,
811+
meshpatch,
812+
meshrow,
813+
metadata,
814+
mpath,
815+
path,
816+
pattern,
817+
polygon,
818+
polyline,
819+
radialGradient,
820+
rect,
821+
set,
822+
solidcolor,
823+
stop,
824+
switch,
825+
symbol,
826+
text,
827+
textPath,
828+
tspan,
829+
unknown,
830+
use,
831+
view {
832+
color-interpolation: arcs;
833+
color-rendering: butt;
834+
cx: crispEdges;
835+
cy: geometricPrecision;
836+
d: optimizeQuality;
837+
fill-opacity: painted;
838+
fill-rule: stroke;
839+
fill: viewport;
840+
image-rendering: visibleFill;
841+
marker-end: visiblePainted;
842+
marker-mid: visibleStroke;
843+
marker-start: bounding-box;
844+
pointer-events: context-fill;
845+
r: context-stroke;
846+
rx: fixed-position;
847+
ry: miter;
848+
shape-rendering: miter-clip;
849+
solid-color: non-scaling-stroke;
850+
solid-opacity: non-scaling-size;
851+
stop-color: non-rotation;
852+
stop-opacity: child(1);
853+
stroke-dasharray: icc-color(foo);
854+
stroke-dashoffset: auto;
855+
stroke-linecap: auto;
856+
stroke-linejoin: auto;
857+
stroke-miterlimit: auto;
858+
stroke-opacity: auto;
859+
stroke-width: auto;
860+
stroke: auto;
861+
text-anchor: auto;
862+
vector-effect: auto;
863+
x: auto;
864+
y: auto;
865+
}

test/test.html

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,110 @@
836836
template {
837837
display: auto;
838838
}
839+
</style>
840+
<style>
841+
.svg2,
842+
animate,
843+
animateMotion,
844+
animateTransform,
845+
circle,
846+
clipPath,
847+
cursor,
848+
defs,
849+
desc,
850+
discard,
851+
ellipse,
852+
feBlend,
853+
feColorMatrix,
854+
feComponentTransfer,
855+
feComposite,
856+
feConvolveMatrix,
857+
feDiffuseLighting,
858+
feDisplacementMap,
859+
feDistantLight,
860+
feDropShadow,
861+
feFlood,
862+
feFuncA,
863+
feFuncB,
864+
feFuncG,
865+
feFuncR,
866+
feGaussianBlur,
867+
feImage,
868+
feMerge,
869+
feMergeNode,
870+
feMorphology,
871+
feOffset,
872+
fePointLight,
873+
feSpecularLighting,
874+
feSpotLight,
875+
feTile,
876+
feTurbulence,
877+
filter,
878+
foreignObject,
879+
g,
880+
hatch,
881+
hatchpath,
882+
image,
883+
line,
884+
linearGradient,
885+
marker,
886+
mesh,
887+
meshgradient,
888+
meshpatch,
889+
meshrow,
890+
metadata,
891+
mpath,
892+
path,
893+
pattern,
894+
polygon,
895+
polyline,
896+
radialGradient,
897+
rect,
898+
set,
899+
solidcolor,
900+
stop,
901+
switch,
902+
symbol,
903+
text,
904+
textPath,
905+
tspan,
906+
unknown,
907+
use,
908+
view {
909+
color-interpolation: arcs;
910+
color-rendering: butt;
911+
cx: crispEdges;
912+
cy: geometricPrecision;
913+
d: optimizeQuality;
914+
fill-opacity: painted;
915+
fill-rule: stroke;
916+
fill: viewport;
917+
image-rendering: visibleFill;
918+
marker-end: visiblePainted;
919+
marker-mid: visibleStroke;
920+
marker-start: bounding-box;
921+
pointer-events: context-fill;
922+
r: context-stroke;
923+
rx: fixed-position;
924+
ry: miter;
925+
shape-rendering: miter-clip;
926+
solid-color: non-scaling-stroke;
927+
solid-opacity: non-scaling-size;
928+
stop-color: non-rotation;
929+
stop-opacity: child(1);
930+
stroke-dasharray: icc-color(foo);
931+
stroke-dashoffset: auto;
932+
stroke-linecap: auto;
933+
stroke-linejoin: auto;
934+
stroke-miterlimit: auto;
935+
stroke-opacity: auto;
936+
stroke-width: auto;
937+
stroke: auto;
938+
text-anchor: auto;
939+
vector-effect: auto;
940+
x: auto;
941+
y: auto;
942+
}
839943
</style>
840944
</head>
841945
<body>

0 commit comments

Comments
 (0)