Skip to content

Commit

Permalink
Fix buildStats when tags and classes are disabled
Browse files Browse the repository at this point in the history
Fixes #11202
  • Loading branch information
bep committed Jul 3, 2023
1 parent 5afc89f commit ceb486f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 9 additions & 0 deletions hugolib/site_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 0 additions & 5 deletions publisher/htmlElementsCollector.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ceb486f

Please sign in to comment.