summaryrefslogtreecommitdiff
path: root/vendor/github.com/tdewolff/parse/v2/html/lex.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/tdewolff/parse/v2/html/lex.go')
-rw-r--r--vendor/github.com/tdewolff/parse/v2/html/lex.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/vendor/github.com/tdewolff/parse/v2/html/lex.go b/vendor/github.com/tdewolff/parse/v2/html/lex.go
index 8774ea264..8e2719504 100644
--- a/vendor/github.com/tdewolff/parse/v2/html/lex.go
+++ b/vendor/github.com/tdewolff/parse/v2/html/lex.go
@@ -23,6 +23,7 @@ const (
TextToken
SvgToken
MathToken
+ TemplateToken
)
// String returns the string representation of a TokenType.
@@ -185,18 +186,19 @@ func (l *Lexer) Next() (TokenType, []byte) {
} else if c == '!' {
l.r.Move(2)
return l.readMarkup()
- } else if 0 < len(l.tmplBegin) && l.at(l.tmplBegin...) {
- l.r.Move(len(l.tmplBegin))
- l.moveTemplate()
- l.hasTmpl = true
} else if c == '?' {
l.r.Move(1)
return CommentToken, l.shiftBogusComment()
}
} else if 0 < len(l.tmplBegin) && l.at(l.tmplBegin...) {
+ if 0 < l.r.Pos() {
+ l.text = l.r.Shift()
+ return TextToken, l.text
+ }
l.r.Move(len(l.tmplBegin))
l.moveTemplate()
l.hasTmpl = true
+ return TemplateToken, l.r.Shift()
} else if c == 0 && l.r.Err() != nil {
if 0 < l.r.Pos() {
l.text = l.r.Shift()