Files
inventory-plus-plus/server/ui/svg/style.go
T
angel fb2f4255f4
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
Tests / Go tests (push) Failing after 15s
prototyped svg reports
2026-08-20 00:23:54 -06:00

30 lines
448 B
Go

package svg
import (
"fmt"
"html"
"maps"
"slices"
"strings"
)
type (
Style map[string]string
)
func (m Style) PrintKey() string {
return "style"
}
func (m Style) PrintValue() (string, bool) {
keys := slices.Collect(maps.Keys(m))
slices.Sort(keys)
parts := make([]string, len(m))
for i, k := range keys {
parts[i] = fmt.Sprintf(`%s: %s`, k, html.EscapeString(m[k]))
}
return fmt.Sprintf("%q", strings.Join(parts, "; ")), true
}