From: Bjørn Erik Pedersen Date: Mon, 3 Jul 2023 07:58:33 +0000 (+0200) Subject: Fix buildStats when tags and classes are disabled X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=ceb486f98c9e5c9308d33c1a54855f44f8207de7;p=brevno-suite%2Fhugo Fix buildStats when tags and classes are disabled Fixes #11202 --- diff --git a/hugolib/site_test.go b/hugolib/site_test.go index 21029352f..effdac6df 100644 --- a/hugolib/site_test.go +++ b/hugolib/site_test.go @@ -1232,6 +1232,15 @@ disabletags = true b = r(` [build.buildStats] +enable = true +disabletags = true +disableclasses = true + `) + + b.AssertFileContent("hugo_stats.json", "! myclass", "! div", "myid") + + b = r(` +[build.buildStats] enable = false `) b.AssertDestinationExists("hugo_stats.json", false) diff --git a/publisher/htmlElementsCollector.go b/publisher/htmlElementsCollector.go index c942c46e5..c9d81818c 100644 --- a/publisher/htmlElementsCollector.go +++ b/publisher/htmlElementsCollector.go @@ -372,11 +372,6 @@ func htmlLexToEndOfComment(w *htmlElementsCollectorWriter) htmlCollectorStateFun func (w *htmlElementsCollectorWriter) parseHTMLElement(elStr string) (el htmlElement, err error) { conf := w.collector.conf - if conf.DisableTags && conf.DisableClasses { - // Nothing to do. - return - } - tagName := parseStartTag(elStr) el.Tag = strings.ToLower(tagName)