Skip to content

Instantly share code, notes, and snippets.

@phdoerfler
Created August 3, 2020 15:27
Show Gist options
  • Save phdoerfler/409dd2df38a985ec41c85464234c7d8f to your computer and use it in GitHub Desktop.
Save phdoerfler/409dd2df38a985ec41c85464234c7d8f to your computer and use it in GitHub Desktop.
val allSvgElements: SortedSet[String] = svg11Elements ++ svg12TinyElementsWithAttributes.keySet
val svgFactories = for {
elementName <- allSvgElements.toSeq.sorted // <-
} yield q"""
object ${Term.Name(elementName)} extends ElementFactory[${Type.Name("SVGElement")}] {
@inline protected def tagName = $elementName
}
"""
object a extends ElementFactory[SVGElement] { @inline protected def tagName = "a" }
object altGlyph extends ElementFactory[SVGElement] { @inline protected def tagName = "altGlyph" }
object altGlyphDef extends ElementFactory[SVGElement] { @inline protected def tagName = "altGlyphDef" }
object altGlyphItem extends ElementFactory[SVGElement] { @inline protected def tagName = "altGlyphItem" }
object animate extends ElementFactory[SVGElement] { @inline protected def tagName = "animate" }
object animateColor extends ElementFactory[SVGElement] { @inline protected def tagName = "animateColor" }
object animateMotion extends ElementFactory[SVGElement] { @inline protected def tagName = "animateMotion" }
object animateTransform extends ElementFactory[SVGElement] { @inline protected def tagName = "animateTransform" }
object animation extends ElementFactory[SVGElement] { @inline protected def tagName = "animation" }
object audio extends ElementFactory[SVGElement] { @inline protected def tagName = "audio" }
object circle extends ElementFactory[SVGElement] { @inline protected def tagName = "circle" }
object clipPath extends ElementFactory[SVGElement] { @inline protected def tagName = "clipPath" }
object color-profile extends ElementFactory[SVGElement] { @inline protected def tagName = "color-profile" }
object cursor extends ElementFactory[SVGElement] { @inline protected def tagName = "cursor" }
object defs extends ElementFactory[SVGElement] { @inline protected def tagName = "defs" }
object desc extends ElementFactory[SVGElement] { @inline protected def tagName = "desc" }
val allSvgElements: SortedSet[String] = svg11Elements ++ svg12TinyElementsWithAttributes.keySet
val svgFactories = for {
elementName <- allSvgElements // <-
} yield q"""
object ${Term.Name(elementName)} extends ElementFactory[${Type.Name("SVGElement")}] {
@inline protected def tagName = $elementName
}
"""
object circle extends ElementFactory[SVGElement] { @inline protected def tagName = "circle" }
object feTile extends ElementFactory[SVGElement] { @inline protected def tagName = "feTile" }
object font-face-format extends ElementFactory[SVGElement] { @inline protected def tagName = "font-face-format" }
object feFuncB extends ElementFactory[SVGElement] { @inline protected def tagName = "feFuncB" }
object pattern extends ElementFactory[SVGElement] { @inline protected def tagName = "pattern" }
object video extends ElementFactory[SVGElement] { @inline protected def tagName = "video" }
object feDisplacementMap extends ElementFactory[SVGElement] { @inline protected def tagName = "feDisplacementMap" }
object linearGradient extends ElementFactory[SVGElement] { @inline protected def tagName = "linearGradient" }
object feColorMatrix extends ElementFactory[SVGElement] { @inline protected def tagName = "feColorMatrix" }
object mpath extends ElementFactory[SVGElement] { @inline protected def tagName = "mpath" }
object feSpotLight extends ElementFactory[SVGElement] { @inline protected def tagName = "feSpotLight" }
object solidColor extends ElementFactory[SVGElement] { @inline protected def tagName = "solidColor" }
object defs extends ElementFactory[SVGElement] { @inline protected def tagName = "defs" }
object textPath extends ElementFactory[SVGElement] { @inline protected def tagName = "textPath" }
object vkern extends ElementFactory[SVGElement] { @inline protected def tagName = "vkern" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment