diff --git a/go.mod b/go.mod index 2e4a113..9287d41 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/urfave/cli/v2 v2.25.1 github.com/xyproto/palgen v1.5.0 - github.com/xyproto/tinysvg v1.1.0 + github.com/xyproto/tinysvg v1.1.1 ) require ( diff --git a/go.sum b/go.sum index 7ac0a4e..9a00d67 100644 --- a/go.sum +++ b/go.sum @@ -15,5 +15,5 @@ github.com/xyproto/burnpal v0.0.0-20191014132200-bd9858647795 h1:AoL5T5pFgiCn/4f github.com/xyproto/burnpal v0.0.0-20191014132200-bd9858647795/go.mod h1:j3S/tDDOEkIChz0sWDqO3zXOgIjz/6nhuc+JrmZNLnA= github.com/xyproto/palgen v1.5.0 h1:JIU39lMxk2Nad1V5hrCUmH8b15R9EdwNTsAzkiII0vU= github.com/xyproto/palgen v1.5.0/go.mod h1:IN7HA45EecW7BTEzkJzaSZljyQdjzNp5kdUQ4gpu0T8= -github.com/xyproto/tinysvg v1.1.0 h1:g8NBSGR90npPhNnbmEIPbkxHdyiFXSQrm5mVVoFFRNA= -github.com/xyproto/tinysvg v1.1.0/go.mod h1:DKgmaYuFIvJab9ug4nH4ZG356VtUaKXG2mUU07GIurs= +github.com/xyproto/tinysvg v1.1.1 h1:sO0F71oODDHoZ9KLC4ucGsdVH9xxgaWIonW/fLF7piM= +github.com/xyproto/tinysvg v1.1.1/go.mod h1:DKgmaYuFIvJab9ug4nH4ZG356VtUaKXG2mUU07GIurs= diff --git a/vendor/github.com/xyproto/tinysvg/README.md b/vendor/github.com/xyproto/tinysvg/README.md index 9d0ceab..0d00de6 100644 --- a/vendor/github.com/xyproto/tinysvg/README.md +++ b/vendor/github.com/xyproto/tinysvg/README.md @@ -6,6 +6,6 @@ This package mainly uses `[]byte` slices instead of strings, and does not indent ## General info -* Version: 1.1.0 +* Version: 1.1.1 * Author: Alexander F. Rødseth <xyproto@archlinux.org> * License: BSD-3 diff --git a/vendor/github.com/xyproto/tinysvg/tags.go b/vendor/github.com/xyproto/tinysvg/tags.go index ba7774f..914d7e0 100644 --- a/vendor/github.com/xyproto/tinysvg/tags.go +++ b/vendor/github.com/xyproto/tinysvg/tags.go @@ -21,6 +21,16 @@ type Tag struct { firstChild *Tag // first child } +var ( + gt = []byte{'>'} + lt = []byte{'<'} + ltSlash = []byte("") + equalEscapedQuote = []byte("=\"") + escapedQuoteSpace = []byte("\" ") + space = []byte{' '} +) + // NewTag creates a new tag based on the given name. // "name" is what will appear right after "<" when rendering as XML/HTML/SVG. func NewTag(name []byte) *Tag { @@ -71,9 +81,9 @@ func (tag *Tag) GetAttrString() []byte { ret = append(ret, ' ') } else { ret = append(ret, key...) - ret = append(ret, []byte("=\"")...) + ret = append(ret, equalEscapedQuote...) // =\" ret = append(ret, value...) - ret = append(ret, []byte("\" ")...) + ret = append(ret, escapedQuoteSpace...) // \" } } if len(ret) > 0 { @@ -100,39 +110,39 @@ func (tag *Tag) getFlatXML() []byte { attrs := tag.GetAttrString() ret := make([]byte, 0) ret = append(ret, spacing...) - ret = append(ret, []byte("<")...) + ret = append(ret, '<') ret = append(ret, tag.name...) if len(attrs) > 0 { - ret = append(ret, []byte(" ")...) + ret = append(ret, ' ') ret = append(ret, attrs...) } if (len(tag.content) == 0) && (len(tag.xmlContent) == 0) && (len(tag.lastContent) == 0) { - ret = append(ret, []byte(" />")...) + ret = append(ret, []byte(spaceSlashGt)...) // /> } else { if len(tag.xmlContent) > 0 { if tag.xmlContent[0] != ' ' { - ret = append(ret, []byte(">")...) + ret = append(ret, '>') ret = append(ret, spacing...) ret = append(ret, tag.xmlContent...) ret = append(ret, spacing...) - ret = append(ret, []byte("")...) + ret = append(ret, '>') } else { - ret = append(ret, []byte(">")...) + ret = append(ret, '>') ret = append(ret, tag.xmlContent...) ret = append(ret, spacing...) - ret = append(ret, []byte("")...) + ret = append(ret, '>') } } else { - ret = append(ret, []byte(">")...) + ret = append(ret, '>') ret = append(ret, tag.content...) ret = append(ret, tag.lastContent...) - ret = append(ret, []byte("")...) + ret = append(ret, '>') } } return ret @@ -179,7 +189,7 @@ func (tag *Tag) writeFlatXML(w io.Writer) (n int64, err error) { return n, err } - x, err = w.Write([]byte("<")) + x, err = w.Write(lt) // < n += int64(x) if err != nil { return n, err @@ -192,32 +202,32 @@ func (tag *Tag) writeFlatXML(w io.Writer) (n int64, err error) { } if len(attrs) > 0 { - x, err = w.Write([]byte(" ")) + x, err = w.Write(space) n += int64(x) if err != nil { return n, err } - x, err = w.Write(attrs) n += int64(x) if err != nil { return n, err } - } + if (len(tag.content) == 0) && (len(tag.xmlContent) == 0) && (len(tag.lastContent) == 0) { - x, err = w.Write([]byte(" />")) + x, err = w.Write(spaceSlashGt) // /> n += int64(x) if err != nil { return n, err } } else { + if len(tag.xmlContent) > 0 { if tag.xmlContent[0] != ' ' { - x, err = w.Write([]byte(">")) + x, err = w.Write(gt) // > n += int64(x) if err != nil { return n, err @@ -241,7 +251,7 @@ func (tag *Tag) writeFlatXML(w io.Writer) (n int64, err error) { return n, err } - x, err = w.Write([]byte("")) + x, err = w.Write(gt) // > n += int64(x) if err != nil { return n, err } } else { - x, err = w.Write([]byte(">")) + x, err = w.Write(gt) // > n += int64(x) if err != nil { return n, err @@ -278,7 +288,7 @@ func (tag *Tag) writeFlatXML(w io.Writer) (n int64, err error) { return n, err } - x, err = w.Write([]byte("")) + x, err = w.Write(gt) // > n += int64(x) if err != nil { return n, err @@ -298,7 +308,7 @@ func (tag *Tag) writeFlatXML(w io.Writer) (n int64, err error) { } } else { - x, err = w.Write([]byte(">")) + x, err = w.Write(gt) // > n += int64(x) if err != nil { return n, err @@ -316,7 +326,7 @@ func (tag *Tag) writeFlatXML(w io.Writer) (n int64, err error) { return n, err } - x, err = w.Write([]byte("")) + x, err = w.Write(gt) // > n += int64(x) if err != nil { return n, err @@ -434,7 +444,7 @@ func (tag *Tag) GetTag(name []byte) (*Tag, error) { } couldNotFindError := fmt.Errorf("could not find tag: %s", name) if tag.CountChildren() == 0 { - // No children. Not found so far + // No children. Not found so far. return nil, couldNotFindError } diff --git a/vendor/github.com/xyproto/tinysvg/tinysvg.go b/vendor/github.com/xyproto/tinysvg/tinysvg.go index 73221a3..aff2a63 100644 --- a/vendor/github.com/xyproto/tinysvg/tinysvg.go +++ b/vendor/github.com/xyproto/tinysvg/tinysvg.go @@ -2,7 +2,6 @@ // // Some function names are suffixed with "2" if they take structs instead of ints/floats, // "i" if they take ints and "f" if they take floats. Using generics might be an option. -// package tinysvg import ( @@ -17,9 +16,9 @@ const ( TRANSPARENT = 0.0 OPAQUE = 1.0 - YES = 0 - NO = 1 - AUTO = 2 + NO = iota + YES + AUTO ) type ( @@ -239,7 +238,7 @@ func (svg *Tag) Stroke2(c *Color) { func RGBBytes(r, g, b int) []byte { rs := strconv.FormatInt(int64(r), 16) gs := strconv.FormatInt(int64(g), 16) - bs := strconv.FormatInt(int64(g), 16) + bs := strconv.FormatInt(int64(b), 16) if len(rs) == 1 && len(gs) == 1 && len(bs) == 1 { // short form return []byte("#" + rs + gs + bs) diff --git a/vendor/modules.txt b/vendor/modules.txt index ef2081e..5730ea5 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -22,6 +22,6 @@ github.com/xyproto/burnpal # github.com/xyproto/palgen v1.5.0 ## explicit; go 1.16 github.com/xyproto/palgen -# github.com/xyproto/tinysvg v1.1.0 +# github.com/xyproto/tinysvg v1.1.1 ## explicit; go 1.9 github.com/xyproto/tinysvg