summaryrefslogtreecommitdiff
path: root/src/post
diff options
context:
space:
mode:
Diffstat (limited to 'src/post')
-rw-r--r--src/post/preprocess.go28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/post/preprocess.go b/src/post/preprocess.go
index 3ec54ca..77aea81 100644
--- a/src/post/preprocess.go
+++ b/src/post/preprocess.go
@@ -17,12 +17,19 @@ type PreprocessFunctions struct {
// The given path should not have a leading slash.
BlogURL func(path string) string
- // BlogURL returns the given string, rooted to the base URL of the blog's
- // HTTP server (which may or may not include path components itself).
+ // BlogHTTPURL returns the given string, rooted to the base URL of the
+ // blog's HTTP server (which may or may not include path components itself).
//
// The given path should not have a leading slash.
BlogHTTPURL func(path string) string
+ // BlogGeminiURL returns the given string, rooted to the base URL of the
+ // blog's gemini server (which may or may not include path components
+ // itself).
+ //
+ // The given path should not have a leading slash.
+ BlogGeminiURL func(path string) string
+
// AssetURL returns the URL of the asset with the given ID.
AssetURL func(id string) string
@@ -43,14 +50,15 @@ type PreprocessFunctions struct {
Image func(args ...string) (string, error)
}
-func (funcs PreprocessFunctions) ToFuncsMap() template.FuncMap {
+func (funcs PreprocessFunctions) ToFuncMap() template.FuncMap {
return template.FuncMap{
- "BlogURL": funcs.BlogURL,
- "BlogHTTPURL": funcs.BlogHTTPURL,
- "AssetURL": funcs.AssetURL,
- "PostURL": funcs.PostURL,
- "StaticURL": funcs.StaticURL,
- "Image": funcs.Image,
+ "BlogURL": funcs.BlogURL,
+ "BlogHTTPURL": funcs.BlogHTTPURL,
+ "BlogGeminiURL": funcs.BlogGeminiURL,
+ "AssetURL": funcs.AssetURL,
+ "PostURL": funcs.PostURL,
+ "StaticURL": funcs.StaticURL,
+ "Image": funcs.Image,
}
}
@@ -61,7 +69,7 @@ func (p Post) PreprocessBody(into io.Writer, funcs PreprocessFunctions) error {
tpl := template.New("")
- tpl.Funcs(funcs.ToFuncsMap())
+ tpl.Funcs(funcs.ToFuncMap())
tpl, err := tpl.Parse(p.Body)