Files
angel 50adc8e2de
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 5s
Tests / Go tests (push) Failing after 20s
prototyped svg reports
2026-08-20 00:35:13 -06:00

38 lines
598 B
Go

package svg
import (
"fmt"
"io"
)
func ExampleSVG() {
s := NewSVG().
Attr(
NewLength(10).
AsX(),
NewLength(20).
AsY(),
Style{
"font-size": "8px",
},
).
Child(
Rect{
Attributes: []RectAttribute{
NewLength(30).
AsX(),
Percentage(40).
AsY(),
},
},
NewText("abc 123"),
)
b, err := io.ReadAll(s.GetMarkupReader())
if err != nil {
panic(err)
}
fmt.Println(string(b))
// Output: <svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="10" y="20" style="font-size: 8px"><rect x="30" y="40%"/><text>abc 123</text></svg>
}