diff options
Diffstat (limited to 'tpl/template.go')
-rw-r--r-- | tpl/template.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tpl/template.go b/tpl/template.go index 91a482c25..70fdf2d3d 100644 --- a/tpl/template.go +++ b/tpl/template.go @@ -191,6 +191,14 @@ func SetHasLockInContext(ctx context.Context, hasLock bool) context.Context { return context.WithValue(ctx, texttemplate.HasLockContextKey, hasLock) } +func GetCallbackFunctionFromContext(ctx context.Context) any { + return ctx.Value(texttemplate.CallbackContextKey) +} + +func SetCallbackFunctionInContext(ctx context.Context, fn any) context.Context { + return context.WithValue(ctx, texttemplate.CallbackContextKey, fn) +} + const hugoNewLinePlaceholder = "___hugonl_" var ( |