From d5ef610113470c598bc83100b3d345894788fbffbb3974e6fe225857528147cb Mon Sep 17 00:00:00 2001 From: Nicholas Johnson Date: Fri, 5 May 2023 00:00:00 +0000 Subject: Don't unnecessarily generate chunk refs --- layouts/_default/single.gmi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'layouts') 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 }} -- cgit v1.2.3