Source File
text.go
Belonging Package
github.com/pancsta/d2/lib/svg
package svgimport ()func ( string) string {:= new(bytes.Buffer)_ = xml.EscapeText(, []byte())return .String()}// EscapeAttribute escapes a value for use in a double-quoted XML attribute.// Single quotes are left unchanged because they cannot terminate that context.// XML attribute whitespace is escaped so parsing preserves the original value.func ( string) string {return strings.ReplaceAll(EscapeText(), "'", "'")}func validateXMLString( string) {if validXMLString() {return}panic("invalid UTF-8 or character in XML value")}func validXMLString( string) bool {if !utf8.ValidString() {return false}for , := range {if validXMLRune() {continue}return false}return true}func validXMLRune( rune) bool {return == '\t' || == '\n' || == '\r' ||>= 0x20 && <= 0xD7FF ||>= 0xE000 && <= 0xFFFD ||>= 0x10000 && <= 0x10FFFF}func ( string) string {return strings.TrimRight(base32.StdEncoding.EncodeToString([]byte()), "=")}
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |