aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Johnson <nick@nicholasjohnson.ch>2023-01-25 00:00:00 +0000
committerNicholas Johnson <nick@nicholasjohnson.ch>2023-01-25 00:00:00 +0000
commit3cd063f392ab3694e540fc018e886f5b6f93d965283b0f51f99d4db77f47aecf (patch)
tree7de5424e1a7f4b34b80df36510888eeba1a6adee49033192332934954428bc48
parent3fb3e566afd980915e0b95022aa18c87eedb0438a36c8f8e6b9e03d0386dd360 (diff)
Make regex more precise
-rw-r--r--layouts/_default/single.gmi8
1 files changed, 4 insertions, 4 deletions
diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi
index ce0d0ce..04c09de 100644
--- a/layouts/_default/single.gmi
+++ b/layouts/_default/single.gmi
@@ -9,12 +9,12 @@
# {{ .Name | safeHTML }}
{{ $content := .RawContent }}
{{- $scratch := newScratch }}
-{{- $chunks := findRE `(?sm)(?:(.*?)(^\x60{3}.*?^\x60{3}$))|(.*$)` $content }}
+{{- $chunks := findRE `(?sm)(?:(.*?)(^\x60{3}[^\x60].*?^\x60{3}$))|(.*$)` $content }}
{{- range $chunks }}
- {{- $before_pre := replaceRE `(?sm)(?:(.*?)(^\x60{3}.*?^\x60{3}$))|(.*$)` "$1" . 1 }}
- {{- $pre := replaceRE `(?sm)(?:(.*?)(^\x60{3}.*?^\x60{3}$))|(.*$)` "$2" . 1 }}
- {{- $after_pre := replaceRE `(?sm)(?:(.*?)(^\x60{3}.*?^\x60{3}$))|(.*$)` "$3" . 1 }}
+ {{- $before_pre := replaceRE `(?sm)(?:(.*?)(^\x60{3}[^\x60].*?^\x60{3}$))|(.*$)` "$1" . 1 }}
+ {{- $pre := replaceRE `(?sm)(?:(.*?)(^\x60{3}[^\x60].*?^\x60{3}$))|(.*$)` "$2" . 1 }}
+ {{- $after_pre := replaceRE `(?sm)(?:(.*?)(^\x60{3}[^\x60].*?^\x60{3}$))|(.*$)` "$3" . 1 }}
{{- $cur_chunk := print $before_pre $after_pre }}