Skip to content

Commit

Permalink
#106 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed May 3, 2024
1 parent 80866da commit 92979d2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 11 additions & 2 deletions bibcop.pl
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ sub check_typography {
my @no_space_after = ( '(', '[' );
my @space_before = ( '(', '[' );
my @space_after = ( ')', ']' );
my @good_tails = ( 'Inc.', 'Ltd.' );
my @bad_tails = ( '.', ',', ';', ':', '-' );
foreach my $tag (keys %entry) {
if ($tag =~ /^:.*/) {
Expand All @@ -307,8 +308,16 @@ sub check_typography {
if ($s eq '.' and $tag eq 'author') {
next;
}
if ($value =~ /^.*\Q$s\E$/) {
return "The '$tag' must not end with a $symbols{$s}"
my $good = 0;
foreach my $s (@good_tails) {
if ($value =~ /^.*\Q$s\E$/) {
$good = 1;
}
}
if (not $good) {
if ($value =~ /^.*\Q$s\E$/) {
return "The '$tag' must not end with a $symbols{$s}"
}
}
}
foreach my $s (@no_space_before) {
Expand Down
1 change: 1 addition & 0 deletions perl-tests/checks.pl
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ package bibcop;
check_passes($f, ('title' => 'Proper formatting of (brackets): with no space after it'));
check_passes($f, ('title' => 'Proper formatting of (brackets); with no space after it'));
check_passes($f, ('title' => 'Proper spaces in \(\phi\) and in $\phi$'));
check_passes($f, ('publisher' => 'Elsevier Science Inc.'));

$f = 'check_wrapping';
check_fails($f, ('title' => 'The title is not surrounded by curled brackets'));
Expand Down

0 comments on commit 92979d2

Please sign in to comment.