summaryrefslogtreecommitdiffstats
path: root/tpl/partials
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-01-04 18:24:36 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-05-16 18:01:29 +0200
commit241b21b0fd34d91fccb2ce69874110dceae6f926 (patch)
treed4e0118eac7e9c42f065815447a70805f8d6ad3e /tpl/partials
parent6aededf6b42011c3039f5f66487a89a8dd65e0e7 (diff)
Create a struct with all of Hugo's config options
Primary motivation is documentation, but it will also hopefully simplify the code. Also, * Lower case the default output format names; this is in line with the custom ones (map keys) and how it's treated all the places. This avoids doing `stringds.EqualFold` everywhere. Closes #10896 Closes #10620
Diffstat (limited to 'tpl/partials')
-rw-r--r--tpl/partials/partials.go9
1 files changed, 3 insertions, 6 deletions
diff --git a/tpl/partials/partials.go b/tpl/partials/partials.go
index 32f86b332..3834529ce 100644
--- a/tpl/partials/partials.go
+++ b/tpl/partials/partials.go
@@ -26,6 +26,7 @@ import (
"github.com/bep/lazycache"
"github.com/gohugoio/hugo/identity"
+
texttemplate "github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate"
"github.com/gohugoio/hugo/tpl"
@@ -34,10 +35,6 @@ import (
"github.com/gohugoio/hugo/deps"
)
-// TestTemplateProvider is global deps.ResourceProvider.
-// NOTE: It's currently unused.
-var TestTemplateProvider deps.ResourceProvider
-
type partialCacheKey struct {
Name string
Variants []any
@@ -130,7 +127,7 @@ func (ns *Namespace) Include(ctx context.Context, name string, contextList ...an
func (ns *Namespace) includWithTimeout(ctx context.Context, name string, dataList ...any) includeResult {
// Create a new context with a timeout not connected to the incoming context.
- timeoutCtx, cancel := context.WithTimeout(context.Background(), ns.deps.Timeout)
+ timeoutCtx, cancel := context.WithTimeout(context.Background(), ns.deps.Conf.Timeout())
defer cancel()
res := make(chan includeResult, 1)
@@ -145,7 +142,7 @@ func (ns *Namespace) includWithTimeout(ctx context.Context, name string, dataLis
case <-timeoutCtx.Done():
err := timeoutCtx.Err()
if err == context.DeadlineExceeded {
- err = fmt.Errorf("partial %q timed out after %s. This is most likely due to infinite recursion. If this is just a slow template, you can try to increase the 'timeout' config setting.", name, ns.deps.Timeout)
+ err = fmt.Errorf("partial %q timed out after %s. This is most likely due to infinite recursion. If this is just a slow template, you can try to increase the 'timeout' config setting.", name, ns.deps.Conf.Timeout())
}
return includeResult{err: err}
}