summaryrefslogtreecommitdiffstats
path: root/tpl
diff options
context:
space:
mode:
Diffstat (limited to 'tpl')
-rw-r--r--tpl/internal/go_templates/texttemplate/hugo_template.go1
-rw-r--r--tpl/transform/transform.go5
-rw-r--r--tpl/transform/transform_test.go5
3 files changed, 7 insertions, 4 deletions
diff --git a/tpl/internal/go_templates/texttemplate/hugo_template.go b/tpl/internal/go_templates/texttemplate/hugo_template.go
index dab5a05a3..96f526005 100644
--- a/tpl/internal/go_templates/texttemplate/hugo_template.go
+++ b/tpl/internal/go_templates/texttemplate/hugo_template.go
@@ -62,6 +62,7 @@ func NewExecuter(helper ExecHelper) Executer {
type (
dataContextKeyType string
hasLockContextKeyType string
+ stackContextKeyType string
)
const (
diff --git a/tpl/transform/transform.go b/tpl/transform/transform.go
index 039d674c4..0f9ad61d4 100644
--- a/tpl/transform/transform.go
+++ b/tpl/transform/transform.go
@@ -15,6 +15,7 @@
package transform
import (
+ "context"
"html"
"html/template"
@@ -118,13 +119,13 @@ func (ns *Namespace) HTMLUnescape(s any) (string, error) {
}
// Markdownify renders s from Markdown to HTML.
-func (ns *Namespace) Markdownify(s any) (template.HTML, error) {
+func (ns *Namespace) Markdownify(ctx context.Context, s any) (template.HTML, error) {
home := ns.deps.Site.Home()
if home == nil {
panic("home must not be nil")
}
- ss, err := home.RenderString(s)
+ ss, err := home.RenderString(ctx, s)
if err != nil {
return "", err
}
diff --git a/tpl/transform/transform_test.go b/tpl/transform/transform_test.go
index edef4e1bd..86ddb1259 100644
--- a/tpl/transform/transform_test.go
+++ b/tpl/transform/transform_test.go
@@ -14,6 +14,7 @@
package transform_test
import (
+ "context"
"html/template"
"strings"
"testing"
@@ -185,7 +186,7 @@ func TestMarkdownify(t *testing.T) {
{tstNoStringer{}, false},
} {
- result, err := ns.Markdownify(test.s)
+ result, err := ns.Markdownify(context.Background(), test.s)
if bb, ok := test.expect.(bool); ok && !bb {
b.Assert(err, qt.Not(qt.IsNil))
@@ -218,7 +219,7 @@ This is some more text.
And then some.
`
- result, err := ns.Markdownify(text)
+ result, err := ns.Markdownify(context.Background(), text)
b.Assert(err, qt.IsNil)
b.Assert(result, qt.Equals, template.HTML(
"<p>#First</p>\n<p>This is some <em>bold</em> text.</p>\n<h2 id=\"second\">Second</h2>\n<p>This is some more text.</p>\n<p>And then some.</p>\n"))