From 6d4519c780aa7a8b0c329650ae1dcc653c5eb0de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= <john@ankarstrom.se> Date: Wed, 11 Nov 2020 02:09:57 +0100 Subject: fix format bug --- rf.pl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'rf.pl') diff --git a/rf.pl b/rf.pl index 7696921..bf54bb5 100755 --- a/rf.pl +++ b/rf.pl @@ -7,7 +7,7 @@ use warnings; my $format_full = '(%a %y)'; my $format_extra = '(%y)'; -my $format_list = '%a (%y). %t. %q. %n, %d. %c: %p. {Available: %w.}'; +my $format_list = '%a (%y). {\fI%t\fR}. {\*Q%q\*U}. %n, %d. %c: %p. {Available: %w.}'; # Internal variables @@ -112,17 +112,17 @@ sub fmt { no warnings; my $val = $ref{$fld}; $val = fmta($val) if $fld eq 'a' and not $full; - $fmt =~ s/\{(.*?)%$fld(.*?)}/$1$val$3/g; - $fmt =~ s/%$fld/$val/g; + $fmt =~ s/\{([^{}%]*)%\Q$fld\E([^{}]*)}/$1$val$2/g; + $fmt =~ s/%\Q$fld\E/$val/g; } else { no warnings; - $fmt =~ s/\{(.*?)%$fld(.*?)}//g; - $fmt =~ s/[.(]?%$fld[.,:;)]?//g; + $fmt =~ s/[.(]?\{([^{}%]*)%\Q$fld\E([^{}]*)}[.,:;)]?//g; + $fmt =~ s/[.(]?%\Q$fld\E[.,:;)]?//g; } } $fmt =~ s/ +/ /g; - $fmt =~ s/([(]) */$1/; - $fmt =~ s/ *([.,)])/$1/; + #$fmt =~ s/([(]) +/$1/; + #$fmt =~ s/ +([.,)])/$1/; $fmt =~ s/^ *//; $fmt =~ s/ *$//; return $fmt; -- cgit v1.2.3