summaryrefslogtreecommitdiff
path: root/vendor/github.com/tdewolff/parse/v2/html/lex.go
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2024-01-09 10:40:38 +0100
committerLibravatar GitHub <noreply@github.com>2024-01-09 10:40:38 +0100
commitf0c3533862bda509cc9082df78f230d00950916b (patch)
tree683bb6141a795e665472571bbd19c8f0e9048b36 /vendor/github.com/tdewolff/parse/v2/html/lex.go
parent[feature] Allow webp emoji uploads / derefs (#2484) (diff)
downloadgotosocial-f0c3533862bda509cc9082df78f230d00950916b.tar.xz
[chore]: Bump github.com/tdewolff/minify/v2 from 2.20.9 to 2.20.12 (#2509)
Bumps [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) from 2.20.9 to 2.20.12. - [Release notes](https://github.com/tdewolff/minify/releases) - [Commits](https://github.com/tdewolff/minify/compare/v2.20.9...v2.20.12) --- updated-dependencies: - dependency-name: github.com/tdewolff/minify/v2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com/tdewolff/parse/v2/html/lex.go')
-rw-r--r--vendor/github.com/tdewolff/parse/v2/html/lex.go22
1 files changed, 12 insertions, 10 deletions
diff --git a/vendor/github.com/tdewolff/parse/v2/html/lex.go b/vendor/github.com/tdewolff/parse/v2/html/lex.go
index e3cb9bd04..c000edccc 100644
--- a/vendor/github.com/tdewolff/parse/v2/html/lex.go
+++ b/vendor/github.com/tdewolff/parse/v2/html/lex.go
@@ -166,6 +166,7 @@ func (l *Lexer) Next() (TokenType, []byte) {
isEndTag := c == '/' && l.r.Peek(2) != '>' && (l.r.Peek(2) != 0 || l.r.PeekErr(2) == nil)
if !isEndTag && (c < 'a' || 'z' < c) && (c < 'A' || 'Z' < c) && c != '!' && c != '?' {
// not a tag
+ l.r.Move(1)
} else if 0 < l.r.Pos() {
// return currently buffered texttoken so that we can return tag next iteration
l.text = l.r.Shift()
@@ -202,8 +203,9 @@ func (l *Lexer) Next() (TokenType, []byte) {
return TextToken, l.text
}
return ErrorToken, nil
+ } else {
+ l.r.Move(1)
}
- l.r.Move(1)
}
}
@@ -539,19 +541,19 @@ func (l *Lexer) shiftXML(rawTag Hash) []byte {
func (l *Lexer) moveTemplate() {
for {
- if c := l.r.Peek(0); l.at(l.tmplEnd...) || c == 0 && l.r.Err() != nil {
- if c != 0 {
- l.r.Move(len(l.tmplEnd))
- }
- break
+ if c := l.r.Peek(0); c == 0 && l.r.Err() != nil {
+ return
+ } else if l.at(l.tmplEnd...) {
+ l.r.Move(len(l.tmplEnd))
+ return
} else if c == '"' || c == '\'' {
l.r.Move(1)
escape := false
for {
- if c2 := l.r.Peek(0); !escape && c2 == c || c2 == 0 && l.r.Err() != nil {
- if c2 != 0 {
- l.r.Move(1)
- }
+ if c2 := l.r.Peek(0); c2 == 0 && l.r.Err() != nil {
+ return
+ } else if !escape && c2 == c {
+ l.r.Move(1)
break
} else if c2 == '\\' {
escape = !escape