From 45c20d03663878f3508eaa9b961cb0cb12cc5574 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Wed, 24 Jul 2024 21:48:38 +0200 Subject: Got post exporting working --- src/gmi/posts_preprocess_funcs.go | 10 ++++++---- src/gmi/tpl.go | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src/gmi') diff --git a/src/gmi/posts_preprocess_funcs.go b/src/gmi/posts_preprocess_funcs.go index f8fcda6..92a9494 100644 --- a/src/gmi/posts_preprocess_funcs.go +++ b/src/gmi/posts_preprocess_funcs.go @@ -6,11 +6,13 @@ import ( "dev.mediocregopher.com/mediocre-blog.git/src/render" ) -type postPreprocessFuncs struct { - urlBuilder render.URLBuilder +// NOTE If I wasn't abandoning this codebase I would give this a proper doc and +// constructor, and make URLBuilder private. +type PostPreprocessFuncs struct { + URLBuilder render.URLBuilder } -func (f postPreprocessFuncs) Image(args ...string) (string, error) { +func (f PostPreprocessFuncs) Image(args ...string) (string, error) { var ( id = args[0] descr = "Image" @@ -21,6 +23,6 @@ func (f postPreprocessFuncs) Image(args ...string) (string, error) { } return fmt.Sprintf( - "\n=> %s %s", f.urlBuilder.Asset(id), descr, + "\n=> %s %s", f.URLBuilder.Asset(id), descr, ), nil } diff --git a/src/gmi/tpl.go b/src/gmi/tpl.go index 5ea114d..d1be26c 100644 --- a/src/gmi/tpl.go +++ b/src/gmi/tpl.go @@ -35,7 +35,7 @@ var tplFS embed.FS func (a *api) tplHandler() (gemini.Handler, error) { var ( - postPreprocessFuncs = postPreprocessFuncs{a.urlBuilder} + postPreprocessFuncs = PostPreprocessFuncs{a.urlBuilder} allTpls = template.New("") ) -- cgit v1.2.3