100 lines
1.4 KiB
Go
100 lines
1.4 KiB
Go
package svg
|
|
|
|
type (
|
|
// SVG models an <svg> element
|
|
SVG struct {
|
|
Element[SVGTag, SVGAttribute, SVGChildren]
|
|
}
|
|
SVGTag struct{}
|
|
|
|
// SVGAttributes are Attributes allowed on SVGs
|
|
SVGAttribute interface {
|
|
Attribute
|
|
IsSVGAttribute()
|
|
}
|
|
|
|
SVGChildren = MarshalerReader
|
|
)
|
|
|
|
// NewSVG create a SVG with the common version 1.1 and svg namespace atributes
|
|
func NewSVG() *SVG {
|
|
return &SVG{
|
|
Element: Element[SVGTag, SVGAttribute, MarshalerReader]{
|
|
Attributes: []SVGAttribute{
|
|
SVGVersion{
|
|
Major: 1,
|
|
Minor: 1,
|
|
},
|
|
XMLNSW32000SVG,
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
func (t SVGTag) PrintTag() string {
|
|
return "svg"
|
|
}
|
|
|
|
func (X) IsSVGAttribute() {
|
|
}
|
|
|
|
func (XP) IsSVGAttribute() {
|
|
}
|
|
|
|
func (Y) IsSVGAttribute() {
|
|
}
|
|
|
|
func (YP) IsSVGAttribute() {
|
|
}
|
|
|
|
func (Width) IsSVGAttribute() {
|
|
}
|
|
|
|
func (WidthP) IsSVGAttribute() {
|
|
}
|
|
|
|
func (Height) IsSVGAttribute() {
|
|
}
|
|
|
|
func (HeightP) IsSVGAttribute() {
|
|
}
|
|
|
|
func (ViewBox) IsSVGAttribute() {
|
|
}
|
|
|
|
func (Style) IsSVGAttribute() {
|
|
}
|
|
|
|
func (Class) IsSVGAttribute() {
|
|
}
|
|
|
|
func (PreserveAspectRatio) IsSVGAttribute() {
|
|
}
|
|
|
|
func (SVGVersion) IsSVGAttribute() {
|
|
}
|
|
|
|
func (XMLNS) IsSVGAttribute() {
|
|
}
|
|
|
|
func (Transform) IsSVGAttribute() {
|
|
}
|
|
|
|
func (TransformRotate) IsSVGAttribute() {
|
|
}
|
|
|
|
func (TransformRotateAbout) IsSVGAttribute() {
|
|
}
|
|
|
|
func (TransformTranslate) IsSVGAttribute() {
|
|
}
|
|
|
|
func (TransformSkewX) IsSVGAttribute() {
|
|
}
|
|
|
|
func (TransformSkewY) IsSVGAttribute() {
|
|
}
|
|
|
|
func (TransformScale) IsSVGAttribute() {
|
|
}
|