File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -55,20 +55,32 @@ func htmlCheck(f *shared.FileContext) {
55
55
func validateHTML (r * bytes.Reader ) error {
56
56
d := xml .NewDecoder (r )
57
57
58
+ path := []string {}
59
+
58
60
//LATER: alternate parser [tdewolff/parse](https://github.com/tdewolff/parse)
59
61
60
62
// Configure the decoder for HTML; leave off strict and autoclose for XHTML
61
63
d .Strict = false
62
64
d .AutoClose = xml .HTMLAutoClose
63
65
d .Entity = xml .HTMLEntity
64
66
for {
65
- _ , err := d .Token ()
67
+ theToken , err := d .Token ()
66
68
if err != nil {
67
69
if err == io .EOF {
68
70
return nil
69
71
}
72
+ //fmt.Printf("err %T path=%v\n", err, path)
70
73
return err
71
74
}
75
+ switch typedToken := theToken .(type ) {
76
+ case xml.StartElement :
77
+ path = append (path , typedToken .Name .Local )
78
+ case xml.EndElement :
79
+ path = path [:len (path )- 1 ]
80
+ default :
81
+ // ignore
82
+ }
83
+
72
84
}
73
85
}
74
86
You can’t perform that action at this time.
0 commit comments