diff options
author | Nicholas Johnson <nick@nicholasjohnson.ch> | 2023-05-05 00:00:00 +0000 |
---|---|---|
committer | Nicholas Johnson <nick@nicholasjohnson.ch> | 2023-05-05 00:00:00 +0000 |
commit | 884bb3dac5b76b08805586f9124b06a475c3beb8aaf87f7da3087c96d9644a2f (patch) | |
tree | 0eac8f134733184379b1a98b7535d6b99c232937f00ac0fce72dc469aca425fb /layouts | |
parent | 072bcf4337a1e1c4e38d3740679c7ba07f625fae7e42802a1eb8ee21366f8faa (diff) | |
download | hugo-theme-journal-884bb3dac5b76b08805586f9124b06a475c3beb8aaf87f7da3087c96d9644a2f.tar.gz hugo-theme-journal-884bb3dac5b76b08805586f9124b06a475c3beb8aaf87f7da3087c96d9644a2f.zip |
Make Gemini ignore link titles
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/single.gmi | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi index 4e6f302..1f97b7e 100644 --- a/layouts/_default/single.gmi +++ b/layouts/_default/single.gmi @@ -19,16 +19,16 @@ {{- $rendered_text := print $before_pre $after_pre }} - {{- $chunk_refs := findRE `!?\[.+?\]\(.+?\)` $rendered_text }} + {{- $chunk_refs := findRE `!?\[(.+?)\]\((.+?)(?:\s+".*?")?\)` $rendered_text }} {{- $scratch.Add "refs" $chunk_refs }} {{- if ($.Page.Params.makerefs | default true) }} {{- range $chunk_refs }} {{- $ref_index = add $ref_index 1 }} - {{- $ref_text := replaceRE `!?\[(.+?)\]\((.+?)\)` "$1" . 1 }} + {{- $ref_text := replaceRE `!?\[(.+?)\]\((.+?)(?:\s+".*?")?\)` "$1" . 1 }} {{- $rendered_text = replace $rendered_text . (print $ref_text "[" $ref_index "]") 1 }} {{- end }} {{- else }} - {{- $rendered_text = $rendered_text | replaceRE `(?m)^!?\[(.+?)\]\((.+?)\)$` (print "=> $2 " $emoji "$1") }} + {{- $rendered_text = $rendered_text | replaceRE `(?m)^!?\[(.+?)\]\((.+?)(?:\s+".*?")?\)$` (print "=> $2 " $emoji "$1") }} {{- end }} {{- $rendered_text = $rendered_text | replaceRE `(?m)^####{1,3}` "###" }} {{- $rendered_text = $rendered_text | replaceRE `\*{3}(\S|\S.*?\S)\*{3}` "$1" }} @@ -53,8 +53,8 @@ ## Links {{- range $refs }} {{- $ref_index = add $ref_index 1 }} - {{- $ref_text := replaceRE `!?\[(.+?)\]\((.+?)\)` "$1" . 1 }} - {{- $ref_link := replaceRE `!?\[(.+?)\]\((.+?)\)` "$2" . 1 }} + {{- $ref_text := replaceRE `!?\[(.+?)\]\((.+?)(?:\s+".*?")?\)` "$1" . 1 }} + {{- $ref_link := replaceRE `!?\[(.+?)\]\((.+?)(?:\s+".*?")?\)` "$2" . 1 }} {{ print "=> " $ref_link (emojify " :link: ") $ref_index ": " $ref_text | safeHTML }} {{- end }} {{- end }} |