diff options
author | Runxi Yu <me@runxiyu.org> | 2025-04-05 23:25:06 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-04-05 23:25:06 +0800 |
commit | cc5ae1a0a1b1abfb147b74e6583f15a585566cf0 (patch) | |
tree | d12ebaf7964b631ad06fd53a21e0d6c3d1480387 | |
parent | Export functions intended to be used in HTML templates (diff) | |
download | forge-cc5ae1a0a1b1abfb147b74e6583f15a585566cf0.tar.gz forge-cc5ae1a0a1b1abfb147b74e6583f15a585566cf0.tar.zst forge-cc5ae1a0a1b1abfb147b74e6583f15a585566cf0.zip |
Move trivial template functions into misc
-rw-r--r-- | internal/misc/trivial.go (renamed from http_template_funcs.go) | 2 | ||||
-rw-r--r-- | resources.go | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/http_template_funcs.go b/internal/misc/trivial.go index 11e4fad..e59c17e 100644 --- a/http_template_funcs.go +++ b/internal/misc/trivial.go @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only // SPDX-FileCopyrightText: Copyright (c) 2025 Runxi Yu <https://runxiyu.org> -package forge +package misc import ( "net/url" diff --git a/resources.go b/resources.go index 637b8ed..e2168a3 100644 --- a/resources.go +++ b/resources.go @@ -32,11 +32,11 @@ func loadTemplates() (err error) { minifier.Add("text/html", &minifierOptions) templates = template.New("templates").Funcs(template.FuncMap{ - "first_line": FirstLine, - "path_escape": PathEscape, - "query_escape": QueryEscape, - "dereference_error": DereferenceOrZero[error], - "minus": Minus, + "first_line": misc.FirstLine, + "path_escape": misc.PathEscape, + "query_escape": misc.QueryEscape, + "dereference_error": misc.DereferenceOrZero[error], + "minus": misc.Minus, }) err = fs.WalkDir(embeddedResourcesFS, "templates", func(path string, d fs.DirEntry, err error) error { |