aboutsummaryrefslogtreecommitdiff
path: root/resources.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-03-31 16:59:18 +0800
committerRunxi Yu <me@runxiyu.org>2025-03-31 16:59:18 +0800
commit655b6b211ae6df0186abd740f248939f7ddeaec1 (patch)
treeec5cdbbc52222f62c8fbb0bcf2a1aa7a9f6eb8b6 /resources.go
parentCorrect table headers in MR indices (diff)
downloadforge-655b6b211ae6df0186abd740f248939f7ddeaec1.tar.gz
forge-655b6b211ae6df0186abd740f248939f7ddeaec1.tar.zst
forge-655b6b211ae6df0186abd740f248939f7ddeaec1.zip
Add descriptive comments to most Go functions
Diffstat (limited to 'resources.go')
-rw-r--r--resources.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/resources.go b/resources.go
index 015f33f..567976d 100644
--- a/resources.go
+++ b/resources.go
@@ -26,6 +26,7 @@ var resourcesFS embed.FS
var templates *template.Template
+// loadTemplates minifies and loads HTML templates.
func loadTemplates() (err error) {
minifier := minify.New()
minifierOptions := html.Minifier{
@@ -36,7 +37,6 @@ func loadTemplates() (err error) {
templates = template.New("templates").Funcs(template.FuncMap{
"first_line": firstLine,
- "base_name": baseName,
"path_escape": pathEscape,
"query_escape": queryEscape,
"dereference_error": dereferenceOrZero[error],
@@ -73,6 +73,8 @@ var (
manHandler http.Handler
)
+// This init sets up static and man handlers. The resulting handlers must be
+// used in the HTTP router, and do nothing unless called from elsewhere.
func init() {
staticFS, err := fs.Sub(resourcesFS, "static")
if err != nil {