texlive[67131] trunk: bibcop (16may23)

commits+karl at tug.org commits+karl at tug.org
Tue May 16 22:20:41 CEST 2023


Revision: 67131
          http://tug.org/svn/texlive?view=revision&revision=67131
Author:   karl
Date:     2023-05-16 22:20:41 +0200 (Tue, 16 May 2023)
Log Message:
-----------
bibcop (16may23)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/bibcop/bibcop.pl
    trunk/Master/texmf-dist/doc/bibtex/bibcop/bibcop.pdf
    trunk/Master/texmf-dist/doc/man/man1/bibcop.1
    trunk/Master/texmf-dist/doc/man/man1/bibcop.man1.pdf
    trunk/Master/texmf-dist/scripts/bibcop/bibcop.pl
    trunk/Master/texmf-dist/source/bibtex/bibcop/bibcop.dtx
    trunk/Master/texmf-dist/tex/latex/bibcop/bibcop.sty
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/libexec/ctan2tds

Modified: trunk/Build/source/texk/texlive/linked_scripts/bibcop/bibcop.pl
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/bibcop/bibcop.pl	2023-05-15 23:43:14 UTC (rev 67130)
+++ trunk/Build/source/texk/texlive/linked_scripts/bibcop/bibcop.pl	2023-05-16 20:20:41 UTC (rev 67131)
@@ -40,6 +40,8 @@
   '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_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 @@
       }
     }
     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 @@
   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 @@
     "      --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 @@
           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 . '}';
         }

Modified: trunk/Master/texmf-dist/doc/bibtex/bibcop/bibcop.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/man/man1/bibcop.1
===================================================================
--- trunk/Master/texmf-dist/doc/man/man1/bibcop.1	2023-05-15 23:43:14 UTC (rev 67130)
+++ trunk/Master/texmf-dist/doc/man/man1/bibcop.1	2023-05-16 20:20:41 UTC (rev 67131)
@@ -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

Modified: trunk/Master/texmf-dist/doc/man/man1/bibcop.man1.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/scripts/bibcop/bibcop.pl
===================================================================
--- trunk/Master/texmf-dist/scripts/bibcop/bibcop.pl	2023-05-15 23:43:14 UTC (rev 67130)
+++ trunk/Master/texmf-dist/scripts/bibcop/bibcop.pl	2023-05-16 20:20:41 UTC (rev 67131)
@@ -40,6 +40,8 @@
   '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_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 @@
       }
     }
     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 @@
   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 @@
     "      --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 @@
           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 . '}';
         }

Modified: trunk/Master/texmf-dist/source/bibtex/bibcop/bibcop.dtx
===================================================================
--- trunk/Master/texmf-dist/source/bibtex/bibcop/bibcop.dtx	2023-05-15 23:43:14 UTC (rev 67130)
+++ trunk/Master/texmf-dist/source/bibtex/bibcop/bibcop.dtx	2023-05-16 20:20:41 UTC (rev 67131)
@@ -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}

Modified: trunk/Master/texmf-dist/tex/latex/bibcop/bibcop.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/bibcop/bibcop.sty	2023-05-15 23:43:14 UTC (rev 67130)
+++ trunk/Master/texmf-dist/tex/latex/bibcop/bibcop.sty	2023-05-16 20:20:41 UTC (rev 67131)
@@ -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]
 
 
 

Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2023-05-15 23:43:14 UTC (rev 67130)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2023-05-16 20:20:41 UTC (rev 67131)
@@ -921,6 +921,7 @@
 # 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

Modified: trunk/Master/tlpkg/libexec/ctan2tds
===================================================================
--- trunk/Master/tlpkg/libexec/ctan2tds	2023-05-15 23:43:14 UTC (rev 67130)
+++ trunk/Master/tlpkg/libexec/ctan2tds	2023-05-16 20:20:41 UTC (rev 67131)
@@ -89,6 +89,7 @@
  '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'",



More information about the tex-live-commits mailing list.