mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-27 14:10:31 +03:00
tpl: Fix it so embedded render-codeblock-goat is used even if custom render-codeblock exists
Fixes #13595
This commit is contained in:
parent
53221f88ca
commit
c8710625b7
3 changed files with 100 additions and 7 deletions
|
@ -827,7 +827,46 @@ func TestPartialHTML(t *testing.T) {
|
|||
}
|
||||
|
||||
// Issue #13593.
|
||||
func TestNoGoat(t *testing.T) {
|
||||
func TestGoatAndNoGoat(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
files := `
|
||||
-- hugo.toml --
|
||||
-- content/_index.md --
|
||||
---
|
||||
title: "Home"
|
||||
---
|
||||
|
||||
|
||||
§§§
|
||||
printf "Hello, world!"
|
||||
§§§
|
||||
|
||||
|
||||
§§§ goat
|
||||
.---. .-. .-. .-. .---.
|
||||
| A +--->| 1 |<--->| 2 |<--->| 3 |<---+ B |
|
||||
'---' '-' '+' '+' '---'
|
||||
§§§
|
||||
|
||||
|
||||
|
||||
-- layouts/all.html --
|
||||
{{ .Content }}
|
||||
|
||||
`
|
||||
|
||||
b := hugolib.Test(t, files)
|
||||
|
||||
// Basic code block.
|
||||
b.AssertFileContent("public/index.html", "<code>printf "Hello, world!"\n</code>")
|
||||
|
||||
// Goat code block.
|
||||
b.AssertFileContent("public/index.html", "Menlo,Lucida")
|
||||
}
|
||||
|
||||
// Issue #13595.
|
||||
func TestGoatAndNoGoatCustomTemplate(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
files := `
|
||||
|
@ -841,6 +880,16 @@ title: "Home"
|
|||
printf "Hello, world!"
|
||||
§§§
|
||||
|
||||
§§§ goat
|
||||
.---. .-. .-. .-. .---.
|
||||
| A +--->| 1 |<--->| 2 |<--->| 3 |<---+ B |
|
||||
'---' '-' '+' '+' '---'
|
||||
§§§
|
||||
|
||||
|
||||
|
||||
-- layouts/_markup/render-codeblock.html --
|
||||
_markup/render-codeblock.html
|
||||
-- layouts/all.html --
|
||||
{{ .Content }}
|
||||
|
||||
|
@ -848,7 +897,51 @@ printf "Hello, world!"
|
|||
|
||||
b := hugolib.Test(t, files)
|
||||
|
||||
b.AssertFileContent("public/index.html", "Hello, world!")
|
||||
// Basic code block.
|
||||
b.AssertFileContent("public/index.html", "_markup/render-codeblock.html")
|
||||
|
||||
// Goat code block.
|
||||
b.AssertFileContent("public/index.html", "Menlo,Lucida")
|
||||
}
|
||||
|
||||
func TestGoatcustom(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
files := `
|
||||
-- hugo.toml --
|
||||
-- content/_index.md --
|
||||
---
|
||||
title: "Home"
|
||||
---
|
||||
|
||||
§§§
|
||||
printf "Hello, world!"
|
||||
§§§
|
||||
|
||||
§§§ goat
|
||||
.---. .-. .-. .-. .---.
|
||||
| A +--->| 1 |<--->| 2 |<--->| 3 |<---+ B |
|
||||
'---' '-' '+' '+' '---'
|
||||
§§§
|
||||
|
||||
|
||||
|
||||
-- layouts/_markup/render-codeblock.html --
|
||||
_markup/render-codeblock.html
|
||||
-- layouts/_markup/render-codeblock-goat.html --
|
||||
_markup/render-codeblock-goat.html
|
||||
-- layouts/all.html --
|
||||
{{ .Content }}
|
||||
|
||||
`
|
||||
|
||||
b := hugolib.Test(t, files)
|
||||
|
||||
// Basic code block.
|
||||
b.AssertFileContent("public/index.html", "_markup/render-codeblock.html")
|
||||
|
||||
// Custom Goat code block.
|
||||
b.AssertFileContent("public/index.html", "_markup/render-codeblock.html_markup/render-codeblock-goat.html")
|
||||
}
|
||||
|
||||
// Issue #13515
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue