diff options
author | John Ankarström <john@ankarstrom.se> | 2020-11-12 02:35:45 +0100 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2020-11-12 02:35:45 +0100 |
commit | 19298d47c5d11bbaedaac530986ce4cb0a9ed06d (patch) | |
tree | a6cf9ba9a0b127ee0d6b67c2e217a780bf296470 | |
parent | a56224ece0712cc5995e45087af097f05d203b47 (diff) | |
download | rf-19298d47c5d11bbaedaac530986ce4cb0a9ed06d.tar.gz |
remove potential double period after author's intial
-rwxr-xr-x | rf | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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; |