Skip to content

Commit

Permalink
html: Add forgotten re test
Browse files Browse the repository at this point in the history
  • Loading branch information
wader committed Aug 21, 2023
1 parent 31de3f9 commit c503bc1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions format/xml/html.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func fromHTMLToArray(n *html.Node) any {
return f(n)
}

var htmlMagicRe = &lazyre.RE{S: `` +
var htmlMagicRE = &lazyre.RE{S: `` +
`^` + // anchor to start
`(?i)` + // case insensitive
`[[:graph:][:space:]]{0,64}?` + // 0-64 non-control ASCII lazily to allow comment etc
Expand All @@ -214,7 +214,7 @@ func decodeHTML(d *decode.D) any {
if d.ArgAs(&pi) {
// if probing the input has to start with "<html" or "<!DOCTYPE html" this
// is because the html parser will always succeed so we have to be careful
if d.RE(htmlMagicRe.Must()) == nil {
if d.RE(htmlMagicRE.Must()) == nil {
d.Fatalf("no <html> or <!DOCTYPE html> found")
}
}
Expand Down

0 comments on commit c503bc1

Please sign in to comment.