[Ur] UrWeb SVG inclusion trial, needs revision

Gabriel Riba gabriel at xarxaire.com
Fri Mar 13 06:25:30 EDT 2015


>
> I have succeeded in the goal, but It probably can be done better.
>

After a study of the type constructor "tag" uses, specially in 
"formtag", "select" and "option", I have a better understanding of it.

Although it is well explained in the manual (XML section), it is not 
easy to understand when there are several abstract concepts, that your 
mind easily skips.

Specially the type constructor "tag" it is confound with the value "tag" 
(that builds up xml subtrees with specific tag) but the different 
parameters they take augments the confusion.


>
> con svgTag = fn (attrs :: {Type}) =>
>          ctx ::: {Unit} ->
>          [[Svg] ~ ctx] =>
>          unit -> tag attrs ([Svg] ++ ctx) ([Svg] ++ ctx) [] []
>

I know now that this is well constructed (specially the outer context 
requirement, and the required context for the inner tags) specially when 
used with container tags like "g" for grouping elements

val g : svgTag (commonAttrs ++ langSpaceAttrs)

so the required inner context match the inner tags outer context 
requirement.

 >
 > val svg : unit -> tag svgTagAttrs body svg [] []
 >
 > 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.

The "svg" tag establishes a new coordinate system. The fragments can be
set up with the grouping tag "g", without redefining the coordinate system.

I could not find a way to encode two possible outer context requirements 
for the svg tag.






More information about the Ur mailing list