diff --git a/publisher/htmlElementsCollector.go b/publisher/htmlElementsCollector.go index daaefe6cf..e2f8fd2ca 100644 --- a/publisher/htmlElementsCollector.go +++ b/publisher/htmlElementsCollector.go @@ -67,7 +67,9 @@ type cssClassCollectorWriter struct { isCollecting bool dropValue bool - inQuote bool + + inQuote bool + quoteValue byte } func (w *cssClassCollectorWriter) Write(p []byte) (n int, err error) { @@ -165,7 +167,12 @@ func (c *cssClassCollectorWriter) startCollecting() { func (c *cssClassCollectorWriter) toggleIfQuote(b byte) { if isQuote(b) { - c.inQuote = !c.inQuote + if c.inQuote && b == c.quoteValue { + c.inQuote = false + } else if !c.inQuote { + c.inQuote = true + c.quoteValue = b + } } } diff --git a/publisher/htmlElementsCollector_test.go b/publisher/htmlElementsCollector_test.go index 24bf87c2d..6b5ef9863 100644 --- a/publisher/htmlElementsCollector_test.go +++ b/publisher/htmlElementsCollector_test.go @@ -87,6 +87,8 @@ func TestClassCollector(t *testing.T) { {"Alpine transition 1", `