]> git.maquefel.me Git - brevno-suite/hugo/commit
strings: fix Truncate behavior for formatted html
authorKhayyam Saleem <hello@khayyam.me>
Fri, 27 Jan 2023 16:57:31 +0000 (11:57 -0500)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 1 Mar 2023 16:59:50 +0000 (17:59 +0100)
commitc0d15a2897be0bc9f6df2514f5a477b6df1fa0e5
tree91cc3691013b51aac6d3b3a41b582be08e4150c9
parent2a61910e824ad2bb223bca65c03460e83bb841e0
strings: fix Truncate behavior for formatted html

Before this fix, strings.Truncate would erroneously re-include
attributes from the opening tag in the closing tag when closing
formatted html, due to a bug in how tagnames were extracted from the
regex capture group for html tags used in `truncate.go`. This change
ensures that only the tagname is retained and all attributes are discarded
when storing the tags for closing them later.

Fixes #10399
tpl/strings/truncate.go
tpl/strings/truncate_test.go