aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2020-11-12 02:35:45 +0100
committerJohn Ankarström <john@ankarstrom.se>2020-11-12 02:35:45 +0100
commit19298d47c5d11bbaedaac530986ce4cb0a9ed06d (patch)
treea6cf9ba9a0b127ee0d6b67c2e217a780bf296470
parenta56224ece0712cc5995e45087af097f05d203b47 (diff)
remove potential double period after author's intial
-rwxr-xr-xrf9
1 files changed, 7 insertions, 2 deletions
diff --git a/rf b/rf
index 76d013f..5822447 100755
--- a/rf
+++ b/rf
@@ -169,8 +169,13 @@ sub fmt {
my $val = $ref{lc $fld};
$val = join '; ', @$val if lc $fld eq 'a';
$val = fmtl($val) if $fld eq 'A';
- $fmt =~ s/\{([^{}%]*)%\Q$fld\E([^{}]*)}/$1$val$2/g;
- $fmt =~ s/%\Q$fld\E/$val/g;
+ if ($val =~ /\.$/) {
+ $fmt =~ s/\{([^{}%]*)%\Q$fld\E([^{}]*)}\.?/$1$val$2/g;
+ $fmt =~ s/%\Q$fld\E\.?/$val/g;
+ } else {
+ $fmt =~ s/\{([^{}%]*)%\Q$fld\E([^{}]*)}/$1$val$2/g;
+ $fmt =~ s/%\Q$fld\E/$val/g;
+ }
} else {
no warnings;
$fmt =~ s/[.([]?\{([^{}%]*)%\Q$fld\E([^{}]*)}[.,?!:;\])]?//g;