diff --git a/hugolib/site_test.go b/hugolib/site_test.go index 3116113c0fe..54c2fbe59d4 100644 --- a/hugolib/site_test.go +++ b/hugolib/site_test.go @@ -1123,7 +1123,7 @@ ABC. els := stats.HTMLElements b.Assert(els.Classes, qt.HasLen, 3606) // (4 * 900) + 4 +2 - b.Assert(els.Tags, qt.HasLen, 8) + b.Assert(els.Tags, qt.HasLen, 9) b.Assert(els.IDs, qt.HasLen, 1) } diff --git a/publisher/htmlElementsCollector.go b/publisher/htmlElementsCollector.go index e033f52d716..7bb2ebf1532 100644 --- a/publisher/htmlElementsCollector.go +++ b/publisher/htmlElementsCollector.go @@ -116,7 +116,13 @@ func (w *cssClassCollectorWriter) Write(p []byte) (n int, err error) { w.buff.Reset() + if strings.HasPrefix(s, "") { + continue + } + + s, tagName := w.insertStandinHTMLElement(s) el := parseHTMLElement(s) + el.Tag = tagName w.collector.mu.Lock() w.collector.elementSet[s] = true @@ -132,6 +138,20 @@ func (w *cssClassCollectorWriter) Write(p []byte) (n int, err error) { return } +// The net/html parser does not handle single table elemnts as input, e.g. tbody. +// We only care about the element/class/ids, so just store away the original tag name +// and pretend it's a