summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-05-16 20:20:41 +0000
committerKarl Berry <karl@freefriends.org>2023-05-16 20:20:41 +0000
commit8c77c4248f99aff397021a2dc16cfa2fa4c14257 (patch)
treeb1d3429ba8bed41f6b49be60701b83fbe91095c3
parent6e97afbb7cb9b7a34ffc9a6c3c5790b40c3a364f (diff)
bibcop (16may23)
git-svn-id: svn://tug.org/texlive/trunk@67131 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/bibcop/bibcop.pl101
-rw-r--r--Master/texmf-dist/doc/bibtex/bibcop/bibcop.pdfbin343290 -> 343404 bytes
-rw-r--r--Master/texmf-dist/doc/man/man1/bibcop.12
-rw-r--r--Master/texmf-dist/doc/man/man1/bibcop.man1.pdfbin13273 -> 13270 bytes
-rwxr-xr-xMaster/texmf-dist/scripts/bibcop/bibcop.pl101
-rw-r--r--Master/texmf-dist/source/bibtex/bibcop/bibcop.dtx2
-rw-r--r--Master/texmf-dist/tex/latex/bibcop/bibcop.sty2
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check1
-rwxr-xr-xMaster/tlpkg/libexec/ctan2tds1
9 files changed, 199 insertions, 11 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/bibcop/bibcop.pl b/Build/source/texk/texlive/linked_scripts/bibcop/bibcop.pl
index eb337fc365e..cfe8e3ac476 100755
--- a/Build/source/texk/texlive/linked_scripts/bibcop/bibcop.pl
+++ b/Build/source/texk/texlive/linked_scripts/bibcop/bibcop.pl
@@ -40,6 +40,8 @@ my %blessed = (
'misc' => ['title', 'author', 'year', 'eprint?', 'archiveprefix?', 'primaryclass?', 'publisher?', 'organization?', 'doi?', 'url?'],
);
+my %minors = map { $_ => 1 } qw/in of at to by the a an and or as if up via yet nor but off on for into/;
+
# Check the presence of mandatory tags.
sub check_mandatory_tags {
my (%entry) = @_;
@@ -71,7 +73,6 @@ sub check_mandatory_tags {
sub check_capitalization {
my (%entry) = @_;
my %tags = map { $_ => 1 } qw/title booktitle journal publisher organization/;
- my %minors = map { $_ => 1 } qw/in of at to by the a an and or as if up via yet nor but off on for into/;
foreach my $tag (keys %entry) {
if (not exists $tags{$tag}) {
next;
@@ -241,13 +242,13 @@ sub check_typography {
}
}
foreach my $s (@space_before) {
- if ($value =~ /^.*[^\s]\Q$s\E.*$/) {
+ if ($value =~ /^.*[^\{\s]\Q$s\E.*$/) {
return "In the '$tag', put a space before the $symbols{$s}"
}
}
foreach my $s (@space_after) {
my $p = join('', @no_space_before);
- if ($value =~ /^.*\Q$s\E[^\s\Q$p\E].*$/) {
+ if ($value =~ /^.*\Q$s\E[^\}\s\Q$p\E].*$/) {
return "In the '$tag', put a space after the $symbols{$s}"
}
}
@@ -435,6 +436,92 @@ sub process_entry {
return @errors;
}
+sub fix_author {
+ my ($value) = @_;
+ my @authors = split(/\s?and\s?/, $value);
+ foreach my $author (@authors) {
+ $author =~ s/^\s+|\s+$//g;
+ $author =~ s/ ([A-Z])($| )/ $1.$2/g;
+ }
+ return join(' and ', @authors);
+}
+
+sub fix_number {
+ my ($value) = @_;
+ $value =~ s/^0+//g;
+ return $value;
+}
+
+sub fix_capitalization {
+ my ($value) = @_;
+ my @words = split(/\s+/, $value);
+ my $pos = 0;
+ foreach my $word (@words) {
+ $pos += 1;
+ if (not $word =~ /^[A-Za-z]/) {
+ next;
+ }
+ if (exists $minors{$word}) {
+ next;
+ }
+ if (exists $minors{lc($word)} and $pos gt 1) {
+ $word = lc($word);
+ next;
+ }
+ if ($word =~ /^[a-z].*/) {
+ $word =~ s/^([a-z])/\U$1/g;
+ }
+ if (index($word, '-') != -1) {
+ $word =~ s/-([a-z])/-\U$1/g;
+ }
+ }
+ return join(' ', @words);
+}
+
+sub fix_title {
+ my ($value) = @_;
+ $value = fix_capitalization($value);
+ return $value;
+}
+
+sub fix_pages {
+ my ($value) = @_;
+ if ($value =~ /^[1-9][0-9]*$/) {
+ return $value;
+ }
+ my ($left, $right) = split(/---|--|-|—|\s/, $value);
+ $left =~ s/^0+//g;
+ $right =~ s/^0+//g;
+ return $left . '--' . $right;
+}
+
+sub fix_booktitle {
+ my ($value) = @_;
+ $value = fix_capitalization($value);
+ if (index($value, 'Proceedings ') != 0) {
+ $value = 'Proceedings of the ' . $value;
+ }
+ return $value;
+}
+
+sub fix_journal {
+ my ($value) = @_;
+ $value = fix_capitalization($value);
+ return $value;
+}
+
+sub fix_publisher {
+ my ($value) = @_;
+ $value = fix_capitalization($value);
+ return $value;
+}
+
+sub fix_organization {
+ my ($value) = @_;
+ $value = fix_capitalization($value);
+ return $value;
+}
+
# Parse the incoming .bib file and return an array
# of hash-maps, where each one is a bibentry.
sub entries {
@@ -640,7 +727,7 @@ if (@ARGV+0 eq 0 or exists $args{'--help'} or exists $args{'-?'}) {
" --latex Report errors in LaTeX format using \\PackageWarningNoLine command\n\n" .
"If any issues, report to GitHub: https://github.com/yegor256/bibcop");
} elsif (exists $args{'--version'} or exists $args{'-v'}) {
- info('0.0.9');
+ info('0.0.10');
} else {
my ($file) = grep { not($_ =~ /^--.*$/) } @ARGV;
if (not $file) {
@@ -667,6 +754,12 @@ if (@ARGV+0 eq 0 or exists $args{'--help'} or exists $args{'-?'}) {
next;
}
my $value = clean_tex($entry{$tag});
+ my $fixer = "fix_$tag";
+ my $fixed = $value;
+ if (defined &{$fixer}) {
+ no strict 'refs';
+ $value = $fixer->($value);
+ }
if ($tag =~ /title|booktitle|journal/) {
$value = '{' . $value . '}';
}
diff --git a/Master/texmf-dist/doc/bibtex/bibcop/bibcop.pdf b/Master/texmf-dist/doc/bibtex/bibcop/bibcop.pdf
index 09a4e1e5d00..be16c4e36da 100644
--- a/Master/texmf-dist/doc/bibtex/bibcop/bibcop.pdf
+++ b/Master/texmf-dist/doc/bibtex/bibcop/bibcop.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/man/man1/bibcop.1 b/Master/texmf-dist/doc/man/man1/bibcop.1
index 19bb874117e..93e3ccd28ea 100644
--- a/Master/texmf-dist/doc/man/man1/bibcop.1
+++ b/Master/texmf-dist/doc/man/man1/bibcop.1
@@ -1,4 +1,4 @@
-.TH bibcop 1 "2023-02-13"
+.TH bibcop 1 "2023-05-16"
.SH NAME
bibcop \- Style Checker and Fixer of BibTeX Files (.bib)
.SH SYNOPSIS
diff --git a/Master/texmf-dist/doc/man/man1/bibcop.man1.pdf b/Master/texmf-dist/doc/man/man1/bibcop.man1.pdf
index a41f85ad2fc..04694d02be6 100644
--- a/Master/texmf-dist/doc/man/man1/bibcop.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/bibcop.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/scripts/bibcop/bibcop.pl b/Master/texmf-dist/scripts/bibcop/bibcop.pl
index eb337fc365e..cfe8e3ac476 100755
--- a/Master/texmf-dist/scripts/bibcop/bibcop.pl
+++ b/Master/texmf-dist/scripts/bibcop/bibcop.pl
@@ -40,6 +40,8 @@ my %blessed = (
'misc' => ['title', 'author', 'year', 'eprint?', 'archiveprefix?', 'primaryclass?', 'publisher?', 'organization?', 'doi?', 'url?'],
);
+my %minors = map { $_ => 1 } qw/in of at to by the a an and or as if up via yet nor but off on for into/;
+
# Check the presence of mandatory tags.
sub check_mandatory_tags {
my (%entry) = @_;
@@ -71,7 +73,6 @@ sub check_mandatory_tags {
sub check_capitalization {
my (%entry) = @_;
my %tags = map { $_ => 1 } qw/title booktitle journal publisher organization/;
- my %minors = map { $_ => 1 } qw/in of at to by the a an and or as if up via yet nor but off on for into/;
foreach my $tag (keys %entry) {
if (not exists $tags{$tag}) {
next;
@@ -241,13 +242,13 @@ sub check_typography {
}
}
foreach my $s (@space_before) {
- if ($value =~ /^.*[^\s]\Q$s\E.*$/) {
+ if ($value =~ /^.*[^\{\s]\Q$s\E.*$/) {
return "In the '$tag', put a space before the $symbols{$s}"
}
}
foreach my $s (@space_after) {
my $p = join('', @no_space_before);
- if ($value =~ /^.*\Q$s\E[^\s\Q$p\E].*$/) {
+ if ($value =~ /^.*\Q$s\E[^\}\s\Q$p\E].*$/) {
return "In the '$tag', put a space after the $symbols{$s}"
}
}
@@ -435,6 +436,92 @@ sub process_entry {
return @errors;
}
+sub fix_author {
+ my ($value) = @_;
+ my @authors = split(/\s?and\s?/, $value);
+ foreach my $author (@authors) {
+ $author =~ s/^\s+|\s+$//g;
+ $author =~ s/ ([A-Z])($| )/ $1.$2/g;
+ }
+ return join(' and ', @authors);
+}
+
+sub fix_number {
+ my ($value) = @_;
+ $value =~ s/^0+//g;
+ return $value;
+}
+
+sub fix_capitalization {
+ my ($value) = @_;
+ my @words = split(/\s+/, $value);
+ my $pos = 0;
+ foreach my $word (@words) {
+ $pos += 1;
+ if (not $word =~ /^[A-Za-z]/) {
+ next;
+ }
+ if (exists $minors{$word}) {
+ next;
+ }
+ if (exists $minors{lc($word)} and $pos gt 1) {
+ $word = lc($word);
+ next;
+ }
+ if ($word =~ /^[a-z].*/) {
+ $word =~ s/^([a-z])/\U$1/g;
+ }
+ if (index($word, '-') != -1) {
+ $word =~ s/-([a-z])/-\U$1/g;
+ }
+ }
+ return join(' ', @words);
+}
+
+sub fix_title {
+ my ($value) = @_;
+ $value = fix_capitalization($value);
+ return $value;
+}
+
+sub fix_pages {
+ my ($value) = @_;
+ if ($value =~ /^[1-9][0-9]*$/) {
+ return $value;
+ }
+ my ($left, $right) = split(/---|--|-|—|\s/, $value);
+ $left =~ s/^0+//g;
+ $right =~ s/^0+//g;
+ return $left . '--' . $right;
+}
+
+sub fix_booktitle {
+ my ($value) = @_;
+ $value = fix_capitalization($value);
+ if (index($value, 'Proceedings ') != 0) {
+ $value = 'Proceedings of the ' . $value;
+ }
+ return $value;
+}
+
+sub fix_journal {
+ my ($value) = @_;
+ $value = fix_capitalization($value);
+ return $value;
+}
+
+sub fix_publisher {
+ my ($value) = @_;
+ $value = fix_capitalization($value);
+ return $value;
+}
+
+sub fix_organization {
+ my ($value) = @_;
+ $value = fix_capitalization($value);
+ return $value;
+}
+
# Parse the incoming .bib file and return an array
# of hash-maps, where each one is a bibentry.
sub entries {
@@ -640,7 +727,7 @@ if (@ARGV+0 eq 0 or exists $args{'--help'} or exists $args{'-?'}) {
" --latex Report errors in LaTeX format using \\PackageWarningNoLine command\n\n" .
"If any issues, report to GitHub: https://github.com/yegor256/bibcop");
} elsif (exists $args{'--version'} or exists $args{'-v'}) {
- info('0.0.9');
+ info('0.0.10');
} else {
my ($file) = grep { not($_ =~ /^--.*$/) } @ARGV;
if (not $file) {
@@ -667,6 +754,12 @@ if (@ARGV+0 eq 0 or exists $args{'--help'} or exists $args{'-?'}) {
next;
}
my $value = clean_tex($entry{$tag});
+ my $fixer = "fix_$tag";
+ my $fixed = $value;
+ if (defined &{$fixer}) {
+ no strict 'refs';
+ $value = $fixer->($value);
+ }
if ($tag =~ /title|booktitle|journal/) {
$value = '{' . $value . '}';
}
diff --git a/Master/texmf-dist/source/bibtex/bibcop/bibcop.dtx b/Master/texmf-dist/source/bibtex/bibcop/bibcop.dtx
index e688e2379e4..a1a5a08c99f 100644
--- a/Master/texmf-dist/source/bibtex/bibcop/bibcop.dtx
+++ b/Master/texmf-dist/source/bibtex/bibcop/bibcop.dtx
@@ -50,7 +50,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{bibcop}
%<*package>
-[2023-02-13 0.0.9 Style Checker of Bibliography Files]
+[2023-05-16 0.0.10 Style Checker of Bibliography Files]
%</package>
%<*driver>
\documentclass{ltxdoc}
diff --git a/Master/texmf-dist/tex/latex/bibcop/bibcop.sty b/Master/texmf-dist/tex/latex/bibcop/bibcop.sty
index d3c5a1287f3..ccc02e1854c 100644
--- a/Master/texmf-dist/tex/latex/bibcop/bibcop.sty
+++ b/Master/texmf-dist/tex/latex/bibcop/bibcop.sty
@@ -31,7 +31,7 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{bibcop}
-[2023-02-13 0.0.9 Style Checker of Bibliography Files]
+[2023-05-16 0.0.10 Style Checker of Bibliography Files]
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index 321d5aec51f..e4c6652c1db 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -921,6 +921,7 @@ my @TLP_working = qw(
# these packages we do not expect to check. Once this list is complete,
# we can start working on tlmgr list | grep shortdesc.
my @TLP_no_check = (
+ "adobeornaments", # nonfree
"afm2pl", # not on ctan
"aleph", # binary
"asymptote", # binary
diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds
index e809e44cb1a..1109f1375b1 100755
--- a/Master/tlpkg/libexec/ctan2tds
+++ b/Master/tlpkg/libexec/ctan2tds
@@ -89,6 +89,7 @@ chomp (my $ctan_root = `tlpkginfo --ctan-root`);
'acrotex-js', "die 'skipping, requires adobe'",
'adobe-euro', "die 'skipping, support for nonfree fonts'",
'adobecaslon', "die 'skipping, support for nonfree fonts'",
+ 'adobeornaments', "die 'skipping, support for nonfree fonts'",
'adrlist', "die 'skipping, noinfo license'",
'ae', "&MAKEae",
'aeb-minitoc', "die 'skipping, per author (dps) request'",