From ceb486f98c9e5c9308d33c1a54855f44f8207de7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 3 Jul 2023 09:58:33 +0200 Subject: [PATCH] Fix buildStats when tags and classes are disabled Fixes #11202 --- hugolib/site_test.go | 9 +++++++++ publisher/htmlElementsCollector.go | 5 ----- 2 files changed, 9 insertions(+), 5 deletions(-) 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)