mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-14 20:33:59 +02:00
Reimplement and simplify Hugo's template system
See #13541 for details. Fixes #13545 Fixes #13515 Closes #7964 Closes #13365 Closes #12988 Closes #4891
This commit is contained in:
@@ -43,7 +43,7 @@ import (
|
||||
"github.com/gohugoio/hugo/resources"
|
||||
"github.com/gohugoio/hugo/resources/resource"
|
||||
"github.com/gohugoio/hugo/resources/resource_factories/create"
|
||||
"github.com/gohugoio/hugo/tpl"
|
||||
"github.com/gohugoio/hugo/tpl/tplimpl"
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"github.com/spf13/cast"
|
||||
)
|
||||
@@ -192,7 +192,7 @@ type BatcherClient struct {
|
||||
d *deps.Deps
|
||||
|
||||
once sync.Once
|
||||
runnerTemplate tpl.Template
|
||||
runnerTemplate *tplimpl.TemplInfo
|
||||
|
||||
createClient *create.Client
|
||||
buildClient *BuildClient
|
||||
@@ -208,7 +208,7 @@ func (c *BatcherClient) New(id string) (js.Batcher, error) {
|
||||
c.once.Do(func() {
|
||||
// We should fix the initialization order here (or use the Go template package directly), but we need to wait
|
||||
// for the Hugo templates to be ready.
|
||||
tmpl, err := c.d.TextTmpl().Parse("batch-esm-runner", runnerTemplateStr)
|
||||
tmpl, err := c.d.TemplateStore.TextParse("batch-esm-runner", runnerTemplateStr)
|
||||
if err != nil {
|
||||
initErr = err
|
||||
return
|
||||
@@ -287,7 +287,7 @@ func (c *BatcherClient) Store() *maps.Cache[string, js.Batcher] {
|
||||
func (c *BatcherClient) buildBatchGroup(ctx context.Context, t *batchGroupTemplateContext) (resource.Resource, string, error) {
|
||||
var buf bytes.Buffer
|
||||
|
||||
if err := c.d.Tmpl().ExecuteWithContext(ctx, c.runnerTemplate, &buf, t); err != nil {
|
||||
if err := c.d.GetTemplateStore().ExecuteWithContext(ctx, c.runnerTemplate, &buf, t); err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user