From 7e1ecc4df44d20d2c9de1c8885ddc2c188062ef0 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Wed, 3 Jul 2024 12:36:05 +0200 Subject: Initial implementation of the gemtext template extension --- example/tpl/render_gemtext.html | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 example/tpl/render_gemtext.html (limited to 'example/tpl') diff --git a/example/tpl/render_gemtext.html b/example/tpl/render_gemtext.html new file mode 100644 index 0000000..0cfdec6 --- /dev/null +++ b/example/tpl/render_gemtext.html @@ -0,0 +1,15 @@ +{{ $pathSplit := splitList "/" .OriginalReq.URL.Path }} +{{ $base := last $pathSplit | default "index.html" }} +{{ $newBase := trimSuffix (ext $base) $base | printf "%s.gmi" }} +{{ $filePath := append (initial $pathSplit) $newBase | join "/" | printf "static%s" }} +{{ if not (fileExists $filePath) }}{{ httpError 404 }}{{ end }} + + + + TODO Title + + + + {{ gemtext (include $filePath) }} + + -- cgit v1.2.3