From 4687677e0c3a09c047e02f2275a50fda2713e136 Mon Sep 17 00:00:00 2001 From: Daniel Asher Resnick Date: Fri, 5 Jan 2024 01:19:23 -0600 Subject: [PATCH] Fix bug with MWTemplate::Parse The slurp after the template name needs to be non-greedy so it ends at the first }}. Now that I think about it, this will break if the template invocation has template/variable calls within it --- MWTemplate.pm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/MWTemplate.pm b/MWTemplate.pm index e5d84e6..15b6bca 100644 --- a/MWTemplate.pm +++ b/MWTemplate.pm @@ -9,9 +9,7 @@ my $DEBUG = 1; sub Parse($input, $template_name) { - # say STDERR "Looking for $template_name in:"; - # say STDERR $input; - my ($contents) = $input =~ /\{\{ \s* $template_name \s* \| (.*) \}\}/sx; + my ($contents) = $input =~ /\{\{ \s* $template_name \s* \| (.*?) \}\}/sx; return 0 unless $contents; my @params = split /\|/, $contents; my @positional_params;