mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-27 22:09:53 +02:00
@@ -15,6 +15,7 @@
|
||||
package templates
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/gohugoio/hugo/helpers"
|
||||
@@ -61,11 +62,11 @@ func (t *executeAsTemplateTransform) Transform(ctx *resources.ResourceTransforma
|
||||
|
||||
ctx.OutPath = t.targetPath
|
||||
|
||||
return t.t.Tmpl().Execute(templ, ctx.To, t.data)
|
||||
return t.t.Tmpl().ExecuteWithContext(ctx.Ctx, templ, ctx.To, t.data)
|
||||
}
|
||||
|
||||
func (c *Client) ExecuteAsTemplate(res resources.ResourceTransformer, targetPath string, data any) (resource.Resource, error) {
|
||||
return res.Transform(&executeAsTemplateTransform{
|
||||
func (c *Client) ExecuteAsTemplate(ctx context.Context, res resources.ResourceTransformer, targetPath string, data any) (resource.Resource, error) {
|
||||
return res.TransformWithContext(ctx, &executeAsTemplateTransform{
|
||||
rs: c.rs,
|
||||
targetPath: helpers.ToSlashTrimLeading(targetPath),
|
||||
t: c.t,
|
||||
|
Reference in New Issue
Block a user