1
1
mirror of https://github.com/wader/fq.git synced 2024-10-26 20:06:29 +03:00

html: Add forgotten re test

This commit is contained in:
Mattias Wadman 2023-08-21 19:25:22 +02:00
parent 31de3f9782
commit c503bc1313

View File

@ -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
@ -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")
}
}