diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-10-30 18:10:09 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-11-03 13:33:31 +0100 |
commit | 1f23b4949c70a2a8f2084fa937e19e93a9fe890a (patch) | |
tree | 28643be27a3059f8286bcd5188238cecc6d06430 /hugolib/collections_test.go | |
parent | 5fc16390355f32b336836163907fc215034f5b73 (diff) | |
download | hugo-1f23b4949c70a2a8f2084fa937e19e93a9fe890a.tar.gz hugo-1f23b4949c70a2a8f2084fa937e19e93a9fe890a.zip |
Fix some RenderShortcodes error cases
This issue fixes two cases where `{{__hugo_ctx` artifacts were left in the rendered output:
1. Inclusion when `.RenderShortcodes` is wrapped in HTML.
2. Inclusion of Markdown file without a trailing newline in some cases.
Closes #12854
Updates #12998
Diffstat (limited to 'hugolib/collections_test.go')
-rw-r--r-- | hugolib/collections_test.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/hugolib/collections_test.go b/hugolib/collections_test.go index fff57337f..a8c817bec 100644 --- a/hugolib/collections_test.go +++ b/hugolib/collections_test.go @@ -71,9 +71,9 @@ tags_weight: %d {{ $pageGroups := slice $cool $blue }} {{ $weighted := slice $wp1 $wp2 }} -{{ printf "pages:%d:%T:%v/%v" (len $pages) $pages (index $pages 0) (index $pages 1) }} -{{ printf "pageGroups:%d:%T:%v/%v" (len $pageGroups) $pageGroups (index (index $pageGroups 0).Pages 0) (index (index $pageGroups 1).Pages 0)}} -{{ printf "weightedPages:%d::%T:%v" (len $weighted) $weighted $weighted | safeHTML }} +{{ printf "pages:%d:%T:%s|%s" (len $pages) $pages (index $pages 0).Path (index $pages 1).Path }} +{{ printf "pageGroups:%d:%T:%s|%s" (len $pageGroups) $pageGroups (index (index $pageGroups 0).Pages 0).Path (index (index $pageGroups 1).Pages 0).Path}} +{{ printf "weightedPages:%d:%T" (len $weighted) $weighted | safeHTML }} `) b.CreateSites().Build(BuildCfg{}) @@ -82,9 +82,9 @@ tags_weight: %d c.Assert(len(b.H.Sites[0].RegularPages()), qt.Equals, 2) b.AssertFileContent("public/index.html", - "pages:2:page.Pages:Page(/page1)/Page(/page2)", - "pageGroups:2:page.PagesGroup:Page(/page1)/Page(/page2)", - `weightedPages:2::page.WeightedPages:[WeightedPage(10,"Page") WeightedPage(20,"Page")]`) + "pages:2:page.Pages:/page1|/page2", + "pageGroups:2:page.PagesGroup:/page1|/page2", + `weightedPages:2:page.WeightedPages`) } func TestUnionFunc(t *testing.T) { @@ -189,7 +189,7 @@ tags_weight: %d {{ $appendStrings := slice "a" "b" | append "c" "d" "e" }} {{ $appendStringsSlice := slice "a" "b" "c" | append (slice "c" "d") }} -{{ printf "pages:%d:%T:%v/%v" (len $pages) $pages (index $pages 0) (index $pages 1) }} +{{ printf "pages:%d:%T:%s|%s" (len $pages) $pages (index $pages 0).Path (index $pages 1).Path }} {{ printf "appendPages:%d:%T:%v/%v" (len $appendPages) $appendPages (index $appendPages 0).Kind (index $appendPages 8).Kind }} {{ printf "appendStrings:%T:%v" $appendStrings $appendStrings }} {{ printf "appendStringsSlice:%T:%v" $appendStringsSlice $appendStringsSlice }} @@ -207,7 +207,7 @@ tags_weight: %d c.Assert(len(b.H.Sites[0].RegularPages()), qt.Equals, 2) b.AssertFileContent("public/index.html", - "pages:2:page.Pages:Page(/page2)/Page(/page1)", + "pages:2:page.Pages:/page2|/page1", "appendPages:9:page.Pages:home/page", "appendStrings:[]string:[a b c d e]", "appendStringsSlice:[]string:[a b c c d]", |