File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 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) {
5555func validateHTML (r * bytes.Reader ) error {
5656 d := xml .NewDecoder (r )
5757
58+ path := []string {}
59+
5860 //LATER: alternate parser [tdewolff/parse](https://github.com/tdewolff/parse)
5961
6062 // Configure the decoder for HTML; leave off strict and autoclose for XHTML
6163 d .Strict = false
6264 d .AutoClose = xml .HTMLAutoClose
6365 d .Entity = xml .HTMLEntity
6466 for {
65- _ , err := d .Token ()
67+ theToken , err := d .Token ()
6668 if err != nil {
6769 if err == io .EOF {
6870 return nil
6971 }
72+ //fmt.Printf("err %T path=%v\n", err, path)
7073 return err
7174 }
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+
7284 }
7385}
7486
You can’t perform that action at this time.
0 commit comments