summaryrefslogtreecommitdiff
path: root/src/gmi/tpl.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/gmi/tpl.go')
-rw-r--r--src/gmi/tpl.go24
1 files changed, 5 insertions, 19 deletions
diff --git a/src/gmi/tpl.go b/src/gmi/tpl.go
index fb62a17..5ea114d 100644
--- a/src/gmi/tpl.go
+++ b/src/gmi/tpl.go
@@ -34,24 +34,10 @@ var tplFS embed.FS
func (a *api) tplHandler() (gemini.Handler, error) {
- preprocessFuncs := post.PreprocessFunctions{
- Image: func(args ...string) (string, error) {
- var (
- id = args[0]
- descr = "Image"
- )
-
- if len(args) > 1 {
- descr = args[1]
- }
-
- return fmt.Sprintf(
- "\n=> %s %s", a.urlBuilder.Asset(id), descr,
- ), nil
- },
- }
-
- allTpls := template.New("")
+ var (
+ postPreprocessFuncs = postPreprocessFuncs{a.urlBuilder}
+ allTpls = template.New("")
+ )
err := fs.WalkDir(tplFS, "tpl", func(path string, d fs.DirEntry, err error) error {
@@ -122,7 +108,7 @@ func (a *api) tplHandler() (gemini.Handler, error) {
a.params.PostStore,
nil, // asset.Store, not supported by gemini endpoint
nil, // post.DraftStore, not supported by gemini endpoint
- preprocessFuncs,
+ postPreprocessFuncs,
))
if errors.Is(err, post.ErrPostNotFound) {