From 3cd063f392ab3694e540fc018e886f5b6f93d965283b0f51f99d4db77f47aecf Mon Sep 17 00:00:00 2001 From: Nicholas Johnson Date: Wed, 25 Jan 2023 00:00:00 +0000 Subject: Make regex more precise --- layouts/_default/single.gmi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'layouts') 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 }} -- cgit v1.2.3