diff options
author | Nicholas Johnson <nick@nicholasjohnson.ch> | 2023-08-25 00:00:00 +0000 |
---|---|---|
committer | Nicholas Johnson <nick@nicholasjohnson.ch> | 2023-08-25 00:00:00 +0000 |
commit | 8a405ead8cf9051e76c99e0fa7820c10b3e892ef996de30179ca779b468e3b2e (patch) | |
tree | e895e951d6640201f10e378fe6f6332fe47f5d371fade78bb3ea8700173dae34 | |
parent | 99732a1cdf09bc3fb225ab602a7af9c65f419bfe5184eebba6ca6e8911672624 (diff) | |
download | hugo-theme-journal-8a405ead8cf9051e76c99e0fa7820c10b3e892ef996de30179ca779b468e3b2e.tar.gz hugo-theme-journal-8a405ead8cf9051e76c99e0fa7820c10b3e892ef996de30179ca779b468e3b2e.zip |
Fix single.gmi reference spacing
-rw-r--r-- | layouts/_default/single.gmi | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi index 605fa96..c8d84e8 100644 --- a/layouts/_default/single.gmi +++ b/layouts/_default/single.gmi @@ -71,18 +71,29 @@ {{ $refs := $scratch.Get "refs" -}} {{ if and (.Page.Params.makerefs | default true) $refs -}} -{{ $ref_index := 0 }} +{{ $ref_index := 0 -}} +{{ $refsMinusOne := sub (len $refs) 1 }} -## {{ i18n "refs" -}} - {{ range $refs -}} - {{ $ref_index = add $ref_index 1 -}} - {{ $ref_text := index . 1 -}} - {{ $ref_link := index . 2 -}} - {{ $ref_title := index . 3 -}} -{{/* render referenced links */ -}} -{{ print "=> " $ref_link (emojify " :link: ") $ref_index ": " (cond (ne (len $ref_title) 0) $ref_title $ref_text) | safeHTML -}} +## {{ i18n "refs" }} - {{ end -}} +{{ range first $refsMinusOne $refs -}} + {{ $ref_index = add $ref_index 1 -}} + {{ $ref_text := index . 1 -}} + {{ $ref_link := index . 2 -}} + {{ $ref_title := index . 3 -}} + + {{/* render referenced links */ -}} +{{ print "=> " $ref_link (emojify " :link: ") $ref_index ": " (cond (ne (len $ref_title) 0) $ref_title $ref_text) | safeHTML }} +{{ end -}} + +{{ range last 1 $refs -}} + {{ $ref_index = add $ref_index 1 -}} + {{ $ref_text := index . 1 -}} + {{ $ref_link := index . 2 -}} + {{ $ref_title := index . 3 -}} + {{/* render referenced link */ -}} +{{ print "=> " $ref_link (emojify " :link: ") $ref_index ": " (cond (ne (len $ref_title) 0) $ref_title $ref_text) | safeHTML -}} +{{ end -}} {{ end -}} {{ end }}
\ No newline at end of file |