summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/templates
diff options
context:
space:
mode:
Diffstat (limited to 'modules/caddyhttp/templates')
-rw-r--r--modules/caddyhttp/templates/tplcontext.go17
1 files changed, 2 insertions, 15 deletions
diff --git a/modules/caddyhttp/templates/tplcontext.go b/modules/caddyhttp/templates/tplcontext.go
index 96a341c..f681399 100644
--- a/modules/caddyhttp/templates/tplcontext.go
+++ b/modules/caddyhttp/templates/tplcontext.go
@@ -305,7 +305,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 any) (string, error) {
- inputStr := toString(input)
+ inputStr := caddy.ToString(input)
md := goldmark.New(
goldmark.WithExtensions(
@@ -341,7 +341,7 @@ func (TemplateContext) funcMarkdown(input any) (string, error) {
// and returns the separated key-value pairs and the body/content. input
// must be a "stringy" value.
func (TemplateContext) funcSplitFrontMatter(input any) (parsedMarkdownDoc, error) {
- meta, body, err := extractFrontMatter(toString(input))
+ meta, body, err := extractFrontMatter(caddy.ToString(input))
if err != nil {
return parsedMarkdownDoc{}, err
}
@@ -465,19 +465,6 @@ func (h WrappedHeader) Del(field string) string {
return ""
}
-func toString(input any) string {
- switch v := input.(type) {
- case string:
- return v
- case fmt.Stringer:
- return v.String()
- case error:
- return v.Error()
- default:
- return fmt.Sprintf("%v", input)
- }
-}
-
var bufPool = sync.Pool{
New: func() any {
return new(bytes.Buffer)