aboutsummaryrefslogtreecommitdiffhomepage
path: root/publisher/htmlElementsCollector.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2020-09-28 22:17:36 +0200
committerBjørn Erik Pedersen <[email protected]>2020-09-28 22:17:36 +0200
commit111344113bf8c16ae45528d67ff408da15961727 (patch)
treecc4998e4945b70944ff28302acc4d485d7dac619 /publisher/htmlElementsCollector.go
parent4855c186d8f05e5e1b0f681b4aa6482a033df241 (diff)
downloadhugo-111344113bf8c16ae45528d67ff408da15961727.tar.gz
hugo-111344113bf8c16ae45528d67ff408da15961727.zip
publisher: Fix writeStats with quote inside quotes
Fixes #7746
Diffstat (limited to 'publisher/htmlElementsCollector.go')
-rw-r--r--publisher/htmlElementsCollector.go11
1 files changed, 9 insertions, 2 deletions
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
+ }
}
}