Make all renderhook Text methods return template.HTML

This commit is contained in:
Bjørn Erik Pedersen
2024-08-31 17:25:15 +02:00
parent f738669a4d
commit 6d97ee711e
13 changed files with 50 additions and 36 deletions

View File

@@ -76,7 +76,7 @@ title: "p1"
{{- range $k, $v := .Attributes -}}
{{- printf " %s=%q" $k $v | safeHTMLAttr -}}
{{- end -}}
>{{ .Text | safeHTML }}</h{{ .Level }}>
>{{ .Text }}</h{{ .Level }}>
`
b := hugolib.Test(t, files)
@@ -146,11 +146,11 @@ title: "p1"
{{ .Content }}
-- layouts/_default/_markup/render-heading.html --
<h{{ .Level }} id="{{ .Anchor | safeURL }}">
{{ .Text | safeHTML }}
{{ .Text }}
<a class="anchor" href="#{{ .Anchor | safeURL }}">#</a>
</h{{ .Level }}>
-- layouts/_default/_markup/render-link.html --
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ .Text | safeHTML }}</a>
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ .Text }}</a>
`
@@ -236,11 +236,11 @@ func BenchmarkRenderHooks(b *testing.B) {
-- config.toml --
-- layouts/_default/_markup/render-heading.html --
<h{{ .Level }} id="{{ .Anchor | safeURL }}">
{{ .Text | safeHTML }}
{{ .Text }}
<a class="anchor" href="#{{ .Anchor | safeURL }}">#</a>
</h{{ .Level }}>
-- layouts/_default/_markup/render-link.html --
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ .Text | safeHTML }}</a>
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ .Text }}</a>
-- layouts/_default/single.html --
{{ .Content }}
`
@@ -452,7 +452,7 @@ Link https procol: https://www.example.org
if withHook {
files += `-- layouts/_default/_markup/render-link.html --
<a href="{{ .Destination | safeURL }}">{{ .Text | safeHTML }}</a>`
<a href="{{ .Destination | safeURL }}">{{ .Text }}</a>`
}
return hugolib.NewIntegrationTestBuilder(