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 | d5ef610113470c598bc83100b3d345894788fbffbb3974e6fe225857528147cb (patch) | |
tree | 72fcb850e11b43288da1797f9c4ec59157ab0a47a691ba8b42231c6d519f0f92 | |
parent | 884bb3dac5b76b08805586f9124b06a475c3beb8aaf87f7da3087c96d9644a2f (diff) | |
download | hugo-theme-journal-d5ef610113470c598bc83100b3d345894788fbffbb3974e6fe225857528147cb.tar.gz hugo-theme-journal-d5ef610113470c598bc83100b3d345894788fbffbb3974e6fe225857528147cb.zip |
Don't unnecessarily generate chunk refs
-rw-r--r-- | layouts/_default/single.gmi | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi index 1f97b7e..13ef9b4 100644 --- a/layouts/_default/single.gmi +++ b/layouts/_default/single.gmi @@ -19,9 +19,9 @@ {{- $rendered_text := print $before_pre $after_pre }} - {{- $chunk_refs := findRE `!?\[(.+?)\]\((.+?)(?:\s+".*?")?\)` $rendered_text }} - {{- $scratch.Add "refs" $chunk_refs }} {{- if ($.Page.Params.makerefs | default true) }} + {{- $chunk_refs := findRESubmatch `!?\[(.+?)\]\((.+?)(?:\s+".*?")?\)` $rendered_text }} + {{- $scratch.Add "refs" $chunk_refs }} {{- range $chunk_refs }} {{- $ref_index = add $ref_index 1 }} {{- $ref_text := replaceRE `!?\[(.+?)\]\((.+?)(?:\s+".*?")?\)` "$1" . 1 }} |