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 6bde2a5f88
13 changed files with 50 additions and 36 deletions

View File

@@ -95,7 +95,7 @@ func (r *htmlRenderer) renderBlockquote(w util.BufWriter, src []byte, node ast.N
BaseContext: render.NewBaseContext(ctx, renderer, n, src, nil, ordinal),
typ: typ,
alertType: alertType,
text: hstring.RenderedString(text),
text: hstring.RenderedHTML(text),
AttributesHolder: attributes.New(n.Attributes(), attributes.AttributesOwnerGeneral),
}
@@ -134,7 +134,7 @@ func (r *htmlRenderer) renderBlockquoteDefault(
type blockquoteContext struct {
hooks.BaseContext
text hstring.RenderedString
text hstring.RenderedHTML
alertType string
typ string
@@ -149,7 +149,7 @@ func (c *blockquoteContext) AlertType() string {
return c.alertType
}
func (c *blockquoteContext) Text() hstring.RenderedString {
func (c *blockquoteContext) Text() hstring.RenderedHTML {
return c.text
}

View File

@@ -32,9 +32,9 @@ func TestBlockquoteHook(t *testing.T) {
block = true
title = true
-- layouts/_default/_markup/render-blockquote.html --
Blockquote: |{{ .Text | safeHTML }}|{{ .Type }}|
Blockquote: |{{ .Text }}|{{ .Type }}|
-- layouts/_default/_markup/render-blockquote-alert.html --
{{ $text := .Text | safeHTML }}
{{ $text := .Text }}
Blockquote Alert: |{{ $text }}|{{ .Type }}|
Blockquote Alert Attributes: |{{ $text }}|{{ .Attributes }}|
Blockquote Alert Page: |{{ $text }}|{{ .Page.Title }}|{{ .PageInner.Title }}|