Since HTML5 admits an SVG tag as html to enclose vector graphics tags,
I have tried to add some types to ensure that they are properly enclosed by an svg html tag, mimicking other types in Basis.urs.
I have succeeded in the goal, but It probably can be done better.There is a quirk, since SVG can be an html level tag but also an inner svg fragment container, but I have not treated this case.
(* -- file SVG.urs *)
con svg = [Svg]
con xsvg = xml svg [] []
con svgTagAttrs = [X = string, Y = string, Width = string,
Height = string,
ViewBox = string, PreserveAspectRatio = string,
ZoomAndPan = string] ++ boxAttrs
val svg : unit -> tag svgTagAttrs body svg [] []
con svgTag = fn (attrs :: {Type}) =>
ctx ::: {Unit} ->
[[Svg] ~ ctx] =>
unit -> tag attrs ([Svg] ++ ctx) ([Svg] ++ ctx) [] []
(*** SVG Events *)
con graphicsElementsEvents = focusEvents ++ mouseEvents
con docEvents = resizeEvents ++ scrollEvents
(*** SVG Attrs *)
con commonAttrs = [Id = id, Base = string]
con langSpaceAttrs = [Lang = string, Space= string]
con transformAttrs = [Transform = string]
con testAttrs = [RequiredFeatures = string, RequiredExtensions = string,
SystemLanguage = string]
con typicalAttrs = commonAttrs ++ langSpaceAttrs ++ transformAttrs ++
testAttrs ++ graphicsElementsEvents
(*** SVG tags *)
val path : svgTag ([D = string, PathLength = string] ++ typicalAttrs)
val text : svgTag ([X = string, Y = string, Dx = string, Dy = string,
Rotate = string, TextLength = string,
LengthAdjust = string] ++ typicalAttrs)
(* ------------------- *)
(* -- project file *)
html5
rewrite url SVGTest/main
ffi SVG
$/list
$/string
SVGTest
(* ------------------- *)
(* -- test program added as attachment *)
SVGTest.tar.gz
Description: GNU Zip compressed data
_______________________________________________ Ur mailing list [email protected] http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
