From 3aaf520a1c4b22192af50029d0b4ef7242e2840c Mon Sep 17 00:00:00 2001 From: David Eisinger Date: Sat, 15 Feb 2025 02:00:11 -0500 Subject: [PATCH] Images working --- themes/v2/layouts/_default/single.gmi | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/themes/v2/layouts/_default/single.gmi b/themes/v2/layouts/_default/single.gmi index bdfdb80..2112acf 100644 --- a/themes/v2/layouts/_default/single.gmi +++ b/themes/v2/layouts/_default/single.gmi @@ -3,12 +3,17 @@ {{ $content = $content | replaceRE `\n+` "" -}} {{ $content = $content | replaceRE `\[([^\]]+)\]\[(\d+)\]` "$1[$2]" -}} {{ $content = $content | replaceRE `(?m)^\[(\d+)\]: (.*)$` "=> $2 [$1] $2" -}} -{{ $content = $content | replaceRE `(?m)\n\n >` "\n\n" -}} -{{ $content = $content | replaceRE `(?m)\n\n ([^>])` " $1" -}} +{{ $content = $content | replaceRE `(?m)\n\n >` "\n\n>" -}} +{{ $content = $content | replaceRE `(?m)\n\n ([A-Z])` " $1" -}} {{ $audioRE := `` }} {{ range findRE $audioRE $content -}} {{ $url := . | replaceRE $audioRE "$1" | replaceRE ` ` "%20" -}} {{ $title := . | replaceRE $audioRE "$2" -}} {{ $content = replace $content . (printf "=> %s %s" $url $title) -}} {{ end -}} +{{ range findRE `{{<(dither|thumbnail) [^/]+/>}}` $content -}} +{{ $rendered := $.Page.RenderString . -}} +{{ $url := $rendered | replaceRE `(?s).*src="([^"]+)".*` "=> $1" -}} +{{ $content = replace $content . $url -}} +{{ end -}} {{ $content | safeHTML }}