mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
tpl/tplimpl: Copy embedded HTML table render hook to each output format
Closes #13351
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
b6c8dfa9dc
commit
18a9ca7d7a
@@ -1508,3 +1508,43 @@ mytexts|safeHTML: {{ partial "mytext.txt" . | safeHTML }}
|
||||
"mytexts|safeHTML: <div>mytext</div>",
|
||||
)
|
||||
}
|
||||
|
||||
func TestIssue13351(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
files := `
|
||||
-- hugo.toml --
|
||||
disableKinds = ['page','rss','section','sitemap','taxonomy','term']
|
||||
[outputs]
|
||||
home = ['html','json']
|
||||
[outputFormats.html]
|
||||
weight = 1
|
||||
[outputFormats.json]
|
||||
weight = 2
|
||||
-- content/_index.md --
|
||||
---
|
||||
title: home
|
||||
---
|
||||
a|b
|
||||
:--|:--
|
||||
1|2
|
||||
-- layouts/index.html --
|
||||
{{ .Content }}
|
||||
-- layouts/index.json --
|
||||
{{ .Content }}
|
||||
`
|
||||
|
||||
b := hugolib.Test(t, files)
|
||||
b.AssertFileContent("public/index.html", "<table>")
|
||||
b.AssertFileContent("public/index.json", "<table>")
|
||||
|
||||
f := strings.ReplaceAll(files, "weight = 1", "weight = 0")
|
||||
b = hugolib.Test(t, f)
|
||||
b.AssertFileContent("public/index.html", "<table>")
|
||||
b.AssertFileContent("public/index.json", "<table>")
|
||||
|
||||
f = strings.ReplaceAll(files, "weight = 1", "")
|
||||
b = hugolib.Test(t, f)
|
||||
b.AssertFileContent("public/index.html", "<table>")
|
||||
b.AssertFileContent("public/index.json", "<table>")
|
||||
}
|
||||
|
Reference in New Issue
Block a user