From b7404377a701ff456475b23e6023913bceb26e63 Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Wed, 28 Feb 2024 11:38:16 -0600 Subject: [PATCH] improve gemini display of li links (esp on about page) --- layouts/_default/single.gmi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi index 4c2436d..62b50d7 100644 --- a/layouts/_default/single.gmi +++ b/layouts/_default/single.gmi @@ -21,9 +21,10 @@ {{ $content := $content | replaceRE `#\s*\[tl!.*\]` "" -}} {{ $content := $content | replaceRE `(.+?)` "[$2]($1)" -}} {{ $content := $content | replaceRE `\sgemini://(\S*)` " [gemini://$1](gemini://$1)" -}} +{{ $content := $content | replaceRE `\n\*\s+\[(.+?)\]\((.+?)\)` "\n=> $2 $1" -}} {{/* $content := $content | replaceRE "([^`])<.*?>([^`])" "$1$2" -*/}} -{{ $content := $content | replaceRE `\n?\n!\[.*\]\((.+?) \"(.+?)\"\)` "\n\n=> $1 Image: $2" -}} -{{ $content := $content | replaceRE `\n?\n!\[.*\]\((.+?)\)` "\n\n=> $1 Embedded Image: $1" -}} +{{ $content := $content | replaceRE `\n?\n!\[.*\]\((.+?) \"(.+?)\"\)` "\n=> $1 Image: $2" -}} +{{ $content := $content | replaceRE `\n?\n!\[.*\]\((.+?)\)` "\n=> $1 Embedded Image: $1" -}} {{ $links := findRE `\n=> ` $content }}{{ $scratch.Set "ref" (add (len $links) 1) }} {{ $refs := findRE `\[.+?\]\(.+?\)` $content }} {{ $scratch.Set "content" $content }}{{ range $refs }}{{ $ref := $scratch.Get "ref" }}{{ $contentInLoop := $scratch.Get "content" }}{{ $url := (printf "%s #%d" . $ref) }}{{ $contentInLoop := replace $contentInLoop . $url -}}{{ $scratch.Set "content" $contentInLoop }}{{ $scratch.Set "ref" (add $ref 1) }}{{ end }}{{ $content := $scratch.Get "content" | replaceRE `\[(.+?)\]\((.+?)\) #(\d+)` "$1 [$3]" -}}