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 /resources | |
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 'resources')
-rw-r--r-- | resources/page/page.go | 2 | ||||
-rw-r--r-- | resources/page/page_markup_integration_test.go | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/resources/page/page.go b/resources/page/page.go index 4cda8d31f..20525669c 100644 --- a/resources/page/page.go +++ b/resources/page/page.go @@ -17,6 +17,7 @@ package page import ( "context" + "fmt" "html/template" "github.com/gohugoio/hugo/markup/converter" @@ -180,6 +181,7 @@ type Page interface { ContentProvider TableOfContentsProvider PageWithoutContent + fmt.Stringer } type PageFragment interface { diff --git a/resources/page/page_markup_integration_test.go b/resources/page/page_markup_integration_test.go index 010a9d729..425099215 100644 --- a/resources/page/page_markup_integration_test.go +++ b/resources/page/page_markup_integration_test.go @@ -161,13 +161,13 @@ includecontent: {{ hugo.Context.MarkupScope }}|{{ $p.Markup.Render.Content }}| b := hugolib.Test(t, files) - b.AssertFileContent("public/p1/index.html", "Render heading: title: P1 scope: |", "Foo scope: |") + b.AssertFileContentExact("public/p1/index.html", "Render heading: title: P1 scope: |", "Foo scope: |") - b.AssertFileContent("public/index.html", + b.AssertFileContentExact("public/index.html", + "Begin:\nincludecontent: home|Render heading: title: P3 scope: home|Foo scope: home|\n|\n:End", "Render heading: title: P1 scope: home|", "Foo scope: home|", "Begin:\nincluderendershortcodes: home|</p>\nRender heading: title: P2 scope: home|<p>|:End", - "Begin:\nincludecontent: home|Render heading: title: P3 scope: home|Foo scope: home|\n|\n:End", ) } |