summaryrefslogtreecommitdiff
path: root/vendor/github.com/tdewolff/parse/v2/html/lex.go
diff options
context:
space:
mode:
authorLibravatar kim <grufwub@gmail.com>2025-08-10 15:05:54 +0200
committerLibravatar kim <gruf@noreply.codeberg.org>2025-08-10 15:05:54 +0200
commit67100809b399b60e58490fa8b1c0a72be75ac820 (patch)
treeae6df939bf9fe557a766120bee3363f89b47f961 /vendor/github.com/tdewolff/parse/v2/html/lex.go
parent[feature + performance] add JSON logging format (#4355) (diff)
downloadgotosocial-67100809b399b60e58490fa8b1c0a72be75ac820.tar.xz
[chore] update dependencies (#4361)
- codeberg.org/gruf/go-kv/v2 v2.0.5 => v2.0.6 - github.com/coreos/go-oidc/v3 v3.14.1 => v3.15.0 - github.com/miekg/dns v1.1.67 => v1.1.68 - github.com/tdewolff/minify/v2 v2.23.9 => v2.23.11 - github.com/yuin/goldmark v1.7.12 => v1.7.13 - golang.org/x/crypto v0.40.0 => v0.41.0 - golang.org/x/image v0.29.0 => v0.30.0 - golang.org/x/net v0.42.0 => v0.43.0 - golang.org/x/sys v0.34.0 => v0.35.0 - golang.org/x/text v0.27.0 => v0.28.0 - modernc.org/sqlite v1.38.0 => v1.38.2 Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4361 Co-authored-by: kim <grufwub@gmail.com> Co-committed-by: kim <grufwub@gmail.com>
Diffstat (limited to 'vendor/github.com/tdewolff/parse/v2/html/lex.go')
-rw-r--r--vendor/github.com/tdewolff/parse/v2/html/lex.go21
1 files changed, 14 insertions, 7 deletions
diff --git a/vendor/github.com/tdewolff/parse/v2/html/lex.go b/vendor/github.com/tdewolff/parse/v2/html/lex.go
index 4eb50f49d..e44a77ce8 100644
--- a/vendor/github.com/tdewolff/parse/v2/html/lex.go
+++ b/vendor/github.com/tdewolff/parse/v2/html/lex.go
@@ -21,8 +21,9 @@ const (
EndTagToken
AttributeToken
TextToken
- SvgToken
+ SVGToken
MathToken
+ XMLToken
TemplateToken
)
@@ -47,10 +48,14 @@ func (tt TokenType) String() string {
return "Attribute"
case TextToken:
return "Text"
- case SvgToken:
- return "Svg"
+ case SVGToken:
+ return "SVG"
case MathToken:
return "Math"
+ case XMLToken:
+ return "XML"
+ case TemplateToken:
+ return "Template"
}
return "Invalid(" + strconv.Itoa(int(tt)) + ")"
}
@@ -371,8 +376,8 @@ func (l *Lexer) shiftStartTag() (TokenType, []byte) {
l.r.Move(1)
}
l.text = parse.ToLower(l.r.Lexeme()[1:])
- if h := ToHash(l.text); h == Textarea || h == Title || h == Style || h == Xmp || h == Iframe || h == Script || h == Plaintext || h == Svg || h == Math {
- if h == Svg || h == Math {
+ if h := ToHash(l.text); h == Textarea || h == Title || h == Style || h == Xmp || h == Iframe || h == Script || h == Plaintext || h == Svg || h == Math || h == Xml {
+ if h == Svg || h == Math || h == Xml {
data := l.shiftXML(h)
if l.err != nil {
return ErrorToken, nil
@@ -380,9 +385,11 @@ func (l *Lexer) shiftStartTag() (TokenType, []byte) {
l.inTag = false
if h == Svg {
- return SvgToken, data
+ return SVGToken, data
+ } else if h == Math {
+ return MathToken, data
}
- return MathToken, data
+ return XMLToken, data
}
l.rawTag = h
}