diff options
author | Nicholas Johnson <nick@nicholasjohnson.ch> | 2023-05-16 00:00:00 +0000 |
---|---|---|
committer | Nicholas Johnson <nick@nicholasjohnson.ch> | 2023-05-16 00:00:00 +0000 |
commit | f59cd17fde1a82a89b4c4543a670a8b212efde8d0018d13a638ccb75426cd9eb (patch) | |
tree | 839cd266f1bfd0817ef6bc7b7e4464487f7f5e32d414c0b9b717afc757d4490a /layouts/_default/single.gmi | |
parent | ed997a97cb92bbb6fb14fb2fb9ff564ecd9c54136910680f812af432ecf90b26 (diff) | |
download | hugo-theme-journal-f59cd17fde1a82a89b4c4543a670a8b212efde8d0018d13a638ccb75426cd9eb.tar.gz hugo-theme-journal-f59cd17fde1a82a89b4c4543a670a8b212efde8d0018d13a638ccb75426cd9eb.zip |
Fix gemini comment spacingv0.5.6
Diffstat (limited to 'layouts/_default/single.gmi')
-rw-r--r-- | layouts/_default/single.gmi | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi index cb834df..d038c3d 100644 --- a/layouts/_default/single.gmi +++ b/layouts/_default/single.gmi @@ -10,8 +10,8 @@ {{ $content := .RawContent }} {{- $scratch := newScratch }} -{{/*- split text into chunks, with each chunk containing 3 parts: above, within, and below preformatted text */}} -{{/*- the regex matching below the preformatted text matches exactly once in the entire text */}} +{{- /* split text into chunks, with each chunk containing 3 parts: above, within, and below preformatted text */}} +{{- /* the regex matching below the preformatted text matches exactly once in the entire text */}} {{- $chunks := findRESubmatch `(?sm)(?:(.+?)(^\x60{3}[^\x60].*?^\x60{3}$))|(.+$)` $content }} {{- $ref_index := 0 }} @@ -21,12 +21,12 @@ {{- $pre := index . 2 }} {{- $below_pre := index . 3 }} - {{/*- mux regex matches above and below preformatted text for rendering (the matches are mutually exclusive) */}} + {{- /* mux regex matches above and below preformatted text for rendering (the matches are mutually exclusive) */}} {{- $rendered_text := print $above_pre $below_pre }} {{- if ($.Page.Params.makerefs | default true) }} - {{/*- find all the links within a chunk */}} + {{- /* find all the links within a chunk */}} {{- $chunk_refs := findRESubmatch `!?\[\s*(.+?)\s*\]\(\s*(.+?)(?:\s+"(.+?)")?\s*\)` $rendered_text }} {{- $scratch.Add "refs" $chunk_refs }} @@ -34,31 +34,31 @@ {{- $ref_index = add $ref_index 1 }} {{- $ref_text := index . 1 }} - {{/*- replace link with reference numbers enclosed in brackets */}} + {{- /*- replace link with reference numbers enclosed in brackets */}} {{- $rendered_text = replace $rendered_text (index . 0) (print $ref_text "[" $ref_index "]") 1 }} {{- end }} {{- else }} - {{/*- render all links directly */}} + {{- /* render all links directly */}} {{- $rendered_text = $rendered_text | replaceRE `(?m)^!?\[\s*(.+?)\s*\]\(\s*(.+?)(?:\s+"(.+?)")?\s*\)$` (print "=> $2 " $emoji "$1") }} {{- end }} - {{/*- trim extra heading symbols */}} + {{- /* trim extra heading symbols */}} {{- $rendered_text = $rendered_text | replaceRE `(?m)^####{1,3}` "###" }} - {{/*- remove bold and italics asterisk symbols */}} + {{- /* remove bold and italics asterisk symbols */}} {{- $rendered_text = $rendered_text | replaceRE `\*{3}(\S|\S.*?\S)\*{3}` "$1" }} {{- $rendered_text = $rendered_text | replaceRE `\*{2}(\S|\S.*?\S)\*{2}` "$1" }} {{- $rendered_text = $rendered_text | replaceRE `\*{1}(\S|\S.*?\S)\*{1}` "$1" }} - {{/*- convert alternative unordered lists symbols to asterisks */}} + {{- /* convert alternative unordered lists symbols to asterisks */}} {{- $rendered_text = $rendered_text | replaceRE `(?m)^[-+] ` "* " }} {{- $rendered_text = $rendered_text | emojify }} - {{/*- demux regex matches above and below preformatted text */}} + {{- /* demux regex matches above and below preformatted text */}} {{- if $above_pre }} {{- $rendered_text | safeHTML }} {{- $pre | safeHTML }} @@ -80,7 +80,7 @@ {{- $ref_link := index . 2 }} {{- $ref_title := index . 3 }} -{{/*- render referenced links */}} +{{- /* render referenced links */}} {{ print "=> " $ref_link (emojify " :link: ") $ref_index ": " (cond (ne (len $ref_title) 0) $ref_title $ref_text) | safeHTML }} {{- end }} |