summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/templates/tplcontext.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/caddyhttp/templates/tplcontext.go')
-rw-r--r--modules/caddyhttp/templates/tplcontext.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/modules/caddyhttp/templates/tplcontext.go b/modules/caddyhttp/templates/tplcontext.go
index bae24ba..96a341c 100644
--- a/modules/caddyhttp/templates/tplcontext.go
+++ b/modules/caddyhttp/templates/tplcontext.go
@@ -44,7 +44,7 @@ import (
type TemplateContext struct {
Root http.FileSystem
Req *http.Request
- Args []interface{} // defined by arguments to funcInclude
+ Args []any // defined by arguments to funcInclude
RespHeader WrappedHeader
CustomFuncs []template.FuncMap // functions added by plugins
@@ -99,7 +99,7 @@ func (c TemplateContext) OriginalReq() http.Request {
// Note that included files are NOT escaped, so you should only include
// trusted files. If it is not trusted, be sure to use escaping functions
// in your template.
-func (c TemplateContext) funcInclude(filename string, args ...interface{}) (string, error) {
+func (c TemplateContext) funcInclude(filename string, args ...any) (string, error) {
bodyBuf := bufPool.Get().(*bytes.Buffer)
bodyBuf.Reset()
@@ -304,7 +304,7 @@ func (TemplateContext) funcStripHTML(s string) string {
// funcMarkdown renders the markdown body as HTML. The resulting
// HTML is NOT escaped so that it can be rendered as HTML.
-func (TemplateContext) funcMarkdown(input interface{}) (string, error) {
+func (TemplateContext) funcMarkdown(input any) (string, error) {
inputStr := toString(input)
md := goldmark.New(
@@ -340,7 +340,7 @@ func (TemplateContext) funcMarkdown(input interface{}) (string, error) {
// splitFrontMatter parses front matter out from the beginning of input,
// and returns the separated key-value pairs and the body/content. input
// must be a "stringy" value.
-func (TemplateContext) funcSplitFrontMatter(input interface{}) (parsedMarkdownDoc, error) {
+func (TemplateContext) funcSplitFrontMatter(input any) (parsedMarkdownDoc, error) {
meta, body, err := extractFrontMatter(toString(input))
if err != nil {
return parsedMarkdownDoc{}, err
@@ -465,7 +465,7 @@ func (h WrappedHeader) Del(field string) string {
return ""
}
-func toString(input interface{}) string {
+func toString(input any) string {
switch v := input.(type) {
case string:
return v
@@ -479,7 +479,7 @@ func toString(input interface{}) string {
}
var bufPool = sync.Pool{
- New: func() interface{} {
+ New: func() any {
return new(bytes.Buffer)
},
}