diff --git a/bibcop.pl b/bibcop.pl index 5136d25..14a2760 100755 --- a/bibcop.pl +++ b/bibcop.pl @@ -441,7 +441,7 @@ sub fix_author { my @authors = split(/\s?and\s?/, $value); foreach my $author (@authors) { $author =~ s/^\s+|\s+$//g; - $author =~ s/ ([A-Z])($| )/ \1.\2/g; + $author =~ s/ ([A-Z])($| )/ $1.$2/g; } return join(' and ', @authors); } @@ -469,10 +469,10 @@ sub fix_capitalization { next; } if ($word =~ /^[a-z].*/) { - $word =~ s/^([a-z])/\U\1/g; + $word =~ s/^([a-z])/\U$1/g; } if (index($word, '-') != -1) { - $word =~ s/-([a-z])/-\U\1/g; + $word =~ s/-([a-z])/-\U$1/g; } } return join(' ', @words); @@ -487,6 +487,9 @@ sub fix_title { sub fix_booktitle { my ($value) = @_; $value = fix_capitalization($value); + if (index($value, 'Proceedings ') != 0) { + $value = 'Proceedings of the ' . $value; + } return $value; } diff --git a/perl-tests/fixing.pl b/perl-tests/fixing.pl index d10d8a5..6c32e6a 100644 --- a/perl-tests/fixing.pl +++ b/perl-tests/fixing.pl @@ -35,6 +35,9 @@ package bibcop; fixes('title', 'Executing a program on the MIT architecture', 'Executing a Program on the MIT Architecture'); fixes('title', 'Executing a program on the MIT Tagged-token Dataflow architecture', 'Executing a Program on the MIT Tagged-Token Dataflow Architecture'); +fixes('booktitle', 'Proceedings of IEEE Symposium on Art', 'Proceedings of IEEE Symposium on Art'); +fixes('booktitle', 'Symposium on Computers', 'Proceedings of the Symposium on Computers'); + fixes('number', '02', '2'); fixes('number', '007', '7'); fixes('number', '16', '16'); diff --git a/testfiles/biblatex.luatex.tlg b/testfiles/biblatex.luatex.tlg index e69de29..bb7e4b9 100644 --- a/testfiles/biblatex.luatex.tlg +++ b/testfiles/biblatex.luatex.tlg @@ -0,0 +1,3 @@ +This is a generated file for the l3build validation system. +Don't change this file in any respect. +LaTeX Warning: Citation 'dijkstra1968letters' on page 1 undefined on input line .... diff --git a/testfiles/biblatex.tlg b/testfiles/biblatex.tlg index e69de29..bb7e4b9 100644 --- a/testfiles/biblatex.tlg +++ b/testfiles/biblatex.tlg @@ -0,0 +1,3 @@ +This is a generated file for the l3build validation system. +Don't change this file in any respect. +LaTeX Warning: Citation 'dijkstra1968letters' on page 1 undefined on input line .... diff --git a/testfiles/biblatex.xetex.tlg b/testfiles/biblatex.xetex.tlg index e69de29..bb7e4b9 100644 --- a/testfiles/biblatex.xetex.tlg +++ b/testfiles/biblatex.xetex.tlg @@ -0,0 +1,3 @@ +This is a generated file for the l3build validation system. +Don't change this file in any respect. +LaTeX Warning: Citation 'dijkstra1968letters' on page 1 undefined on input line .... diff --git a/testfiles/bibtex.luatex.tlg b/testfiles/bibtex.luatex.tlg index fa9b9c8..a8a2ef0 100644 --- a/testfiles/bibtex.luatex.tlg +++ b/testfiles/bibtex.luatex.tlg @@ -2,7 +2,13 @@ This is a generated file for the l3build validation system. Don't change this file in any respect. LaTeX Warning: Citation `dijkstra1968letters' on page 1 undefined on input line .... runsystem((perl ./bibcop.pl --verbose --latex 'main.bib') > iexec.tmp 2>&1; /bin/echo -n $?% >iexec.ret)...executed -(iexec.tmp -! Undefined control sequence. -l. ...\1 - better written as $1 at ./bibcop.pl line 444. +(iexec.tmp bibcop: 1 entries found in main.bib +bibcop: Checking dijkstra1968letters (no.0)... +Package bibcop Warning: All minor words in the 'title' must be lower-cased, while 'To' (no.6) is not, in the 'dijkstra1968letters' entry. +Package bibcop Warning: A mandatory 'doi' tag for '@article' is missing among (author, journal, number, pages, publisher, title, volume, year), in the 'dijkstra1968letters' entry. +Package bibcop Warning: The 'title' must be wrapped in double curled brackets, in the 'dijkstra1968letters' entry. +) iexec: The content of 'iexec.tmp' was included into the document +runsystem(rm iexec.tmp)...executed +runsystem(rm iexec.ret)...executed +bibcop: style checking finished +(bibtex.bbl) diff --git a/testfiles/bibtex.tlg b/testfiles/bibtex.tlg index 95ad8c5..fc5d524 100644 --- a/testfiles/bibtex.tlg +++ b/testfiles/bibtex.tlg @@ -2,7 +2,13 @@ This is a generated file for the l3build validation system. Don't change this file in any respect. LaTeX Warning: Citation `dijkstra1968letters' on page 1 undefined on input line .... runsystem((perl ./bibcop.pl --verbose --latex 'main.bib') > iexec.tmp 2>&1; /bin/echo -n $?% >iexec.ret)...executed. -(iexec.tmp -! Undefined control sequence. -l. ...\1 - better written as $1 at ./bibcop.pl line 444. +(iexec.tmp bibcop: 1 entries found in main.bib +bibcop: Checking dijkstra1968letters (no.0)... +Package bibcop Warning: All minor words in the 'title' must be lower-cased, while 'To' (no.6) is not, in the 'dijkstra1968letters' entry. +Package bibcop Warning: A mandatory 'doi' tag for '@article' is missing among (author, journal, number, pages, publisher, title, volume, year), in the 'dijkstra1968letters' entry. +Package bibcop Warning: The 'title' must be wrapped in double curled brackets, in the 'dijkstra1968letters' entry. +) iexec: The content of 'iexec.tmp' was included into the document +runsystem(rm iexec.tmp)...executed. +runsystem(rm iexec.ret)...executed. +bibcop: style checking finished +(bibtex.bbl) diff --git a/testfiles/bibtex.xetex.tlg b/testfiles/bibtex.xetex.tlg index 95ad8c5..fc5d524 100644 --- a/testfiles/bibtex.xetex.tlg +++ b/testfiles/bibtex.xetex.tlg @@ -2,7 +2,13 @@ This is a generated file for the l3build validation system. Don't change this file in any respect. LaTeX Warning: Citation `dijkstra1968letters' on page 1 undefined on input line .... runsystem((perl ./bibcop.pl --verbose --latex 'main.bib') > iexec.tmp 2>&1; /bin/echo -n $?% >iexec.ret)...executed. -(iexec.tmp -! Undefined control sequence. -l. ...\1 - better written as $1 at ./bibcop.pl line 444. +(iexec.tmp bibcop: 1 entries found in main.bib +bibcop: Checking dijkstra1968letters (no.0)... +Package bibcop Warning: All minor words in the 'title' must be lower-cased, while 'To' (no.6) is not, in the 'dijkstra1968letters' entry. +Package bibcop Warning: A mandatory 'doi' tag for '@article' is missing among (author, journal, number, pages, publisher, title, volume, year), in the 'dijkstra1968letters' entry. +Package bibcop Warning: The 'title' must be wrapped in double curled brackets, in the 'dijkstra1968letters' entry. +) iexec: The content of 'iexec.tmp' was included into the document +runsystem(rm iexec.tmp)...executed. +runsystem(rm iexec.ret)...executed. +bibcop: style checking finished +(bibtex.bbl)