aboutsummaryrefslogtreecommitdiff
path: root/internal/template/template.go
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-04-21 22:20:42 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-04-21 22:20:42 +0200
commit0179262628cadd3ed402880a03f3d812f327feec (patch)
tree32c193f533087edf0916d11d61e0fa33172f8961 /internal/template/template.go
parent89f46e31998dd62a52d7dd07b16f1d81d9597e3e (diff)
downloadfeed2imap-go-0179262628cadd3ed402880a03f3d812f327feec.tar.gz
feed2imap-go-0179262628cadd3ed402880a03f3d812f327feec.tar.bz2
feed2imap-go-0179262628cadd3ed402880a03f3d812f327feec.zip
Improved HTML creation
Diffstat (limited to 'internal/template/template.go')
-rw-r--r--internal/template/template.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/internal/template/template.go b/internal/template/template.go
index 350a0ed..a239484 100644
--- a/internal/template/template.go
+++ b/internal/template/template.go
@@ -24,7 +24,7 @@ func join(sep string, parts []string) string {
return strings.Join(parts, sep)
}
-func LastUrlPart(url string) string {
+func lastUrlPart(url string) string {
split := strings.Split(url, "/")
return split[len(split)-1]
}
@@ -42,11 +42,16 @@ func byteCount(b int64) string {
return fmt.Sprintf("%.1f %cB", float64(b)/float64(div), "KMGTPE"[exp])
}
+func html(s string) template.HTML {
+ return template.HTML(s)
+}
+
var funcMap = template.FuncMap{
"dict": dict,
"join": join,
- "lastUrlPart": LastUrlPart,
+ "lastUrlPart": lastUrlPart,
"byteCount": byteCount,
+ "html": html,
}
func fromString(name, templateStr string) *template.Template {