summaryrefslogtreecommitdiffstats
path: root/hugolib/content_render_hooks_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-03-09 10:26:44 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-03-09 13:26:39 +0100
commit18074d0c2375cc4bf4d7933dd4206cb878a23d1c (patch)
treea244eb41d5d0888494b0003e807a1884f17f4ac8 /hugolib/content_render_hooks_test.go
parent35bfb662229226d5f3cc3077ca74323f0aa88b7d (diff)
Fix output format handling for render hooks
Fixes #8176
Diffstat (limited to 'hugolib/content_render_hooks_test.go')
-rw-r--r--hugolib/content_render_hooks_test.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/hugolib/content_render_hooks_test.go b/hugolib/content_render_hooks_test.go
index 218ad918b..979168305 100644
--- a/hugolib/content_render_hooks_test.go
+++ b/hugolib/content_render_hooks_test.go
@@ -315,8 +315,10 @@ func TestRenderHooksRSS(t *testing.T) {
b.WithTemplates("index.html", `
{{ $p := site.GetPage "p1.md" }}
+{{ $p2 := site.GetPage "p2.md" }}
P1: {{ $p.Content }}
+P2: {{ $p2.Content }}
`, "index.xml", `
@@ -330,6 +332,8 @@ P3: {{ $p3.Content }}
`,
"_default/_markup/render-link.html", `html-link: {{ .Destination | safeURL }}|`,
"_default/_markup/render-link.rss.xml", `xml-link: {{ .Destination | safeURL }}|`,
+ "_default/_markup/render-heading.html", `html-heading: {{ .Text }}|`,
+ "_default/_markup/render-heading.rss.xml", `xml-heading: {{ .Text }}|`,
)
b.WithContent("p1.md", `---
@@ -337,12 +341,14 @@ title: "p1"
---
P1. [I'm an inline-style link](https://www.gohugo.io)
+# Heading in p1
`, "p2.md", `---
title: "p2"
---
P1. [I'm an inline-style link](https://www.bep.is)
+# Heading in p2
`,
"p3.md", `---
@@ -356,10 +362,15 @@ P3. [I'm an inline-style link](https://www.example.org)
b.Build(BuildCfg{})
- b.AssertFileContent("public/index.html", "P1: <p>P1. html-link: https://www.gohugo.io|</p>")
+ b.AssertFileContent("public/index.html", `
+P1: <p>P1. html-link: https://www.gohugo.io|</p>
+html-heading: Heading in p1|
+html-heading: Heading in p2|
+`)
b.AssertFileContent("public/index.xml", `
P2: <p>P1. xml-link: https://www.bep.is|</p>
P3: <p>P3. xml-link: https://www.example.org|</p>
+xml-heading: Heading in p2|
`)
}