aboutsummaryrefslogtreecommitdiffstats
path: root/internal/web/templates.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/web/templates.go')
-rw-r--r--internal/web/templates.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/internal/web/templates.go b/internal/web/templates.go
index 7f71304..c2f9847 100644
--- a/internal/web/templates.go
+++ b/internal/web/templates.go
@@ -110,9 +110,12 @@ var funcs = template.FuncMap{
"rfc": func(t time.Time) string { return t.Format(time.RFC1123Z) },
"html": func(s string) template.HTML { return template.HTML(s) },
"css": func(s string) template.CSS { return template.CSS(s) },
- "kb": func(n int) string { return fmt.Sprintf("%.0f KB", float64(n)/1024) },
- "add": func(a, b int) int { return a + b },
- "sub": func(a, b int) int { return a - b },
+ "size": humanSize,
+ "mb": func(n int64) int64 { return n >> 20 },
+ // filemd is the Markdown line for a library file, what "Insert file" writes
+ "filemd": fileMarkdown,
+ "add": func(a, b int) int { return a + b },
+ "sub": func(a, b int) int { return a - b },
"deref": func(p *string) string {
if p == nil {
return ""