aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib/page__per_output.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2022-05-25 10:56:14 +0200
committerBjørn Erik Pedersen <[email protected]>2022-05-25 17:55:23 +0200
commit3854a6fa6c323d1c09aa71a0626c9eef62709294 (patch)
treeea3727c14f73fb73aef89d43795dd6d6f75f1220 /hugolib/page__per_output.go
parentcd0112a05a9ddb7043c9808284f93d8099c48473 (diff)
downloadhugo-3854a6fa6c323d1c09aa71a0626c9eef62709294.tar.gz
hugo-3854a6fa6c323d1c09aa71a0626c9eef62709294.zip
Fix Plainify edge cases
This commit replaces the main part of `helpers.StripHTML` with Go's implementation in its html/template package. It's a little slower, but correctness is more important: ```bash BenchmarkStripHTMLOld-10 680316 1764 ns/op 728 B/op 4 allocs/op BenchmarkStripHTMLNew-10 384520 3099 ns/op 2089 B/op 10 allocs/op ``` Fixes #9199 Fixes #9909 Closes #9410
Diffstat (limited to 'hugolib/page__per_output.go')
-rw-r--r--hugolib/page__per_output.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/hugolib/page__per_output.go b/hugolib/page__per_output.go
index 6460b120b..59299b709 100644
--- a/hugolib/page__per_output.go
+++ b/hugolib/page__per_output.go
@@ -201,7 +201,7 @@ func newPageContentOutput(p *pageState, po *pageOutput) (*pageContentOutput, err
})
cp.initPlain = cp.initMain.Branch(func() (any, error) {
- cp.plain = helpers.StripHTML(string(cp.content))
+ cp.plain = tpl.StripHTML(string(cp.content))
cp.plainWords = strings.Fields(cp.plain)
cp.setWordCounts(p.m.isCJKLanguage)