texlive[65265] trunk: bibcop (13dec22)

commits+karl at tug.org commits+karl at tug.org
Tue Dec 13 22:08:44 CET 2022


Revision: 65265
          http://tug.org/svn/texlive?view=revision&revision=65265
Author:   karl
Date:     2022-12-13 22:08:43 +0100 (Tue, 13 Dec 2022)
Log Message:
-----------
bibcop (13dec22)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/bibcop/bibcop.pl
    trunk/Master/texmf-dist/doc/latex/bibcop/DEPENDS.txt
    trunk/Master/texmf-dist/doc/latex/bibcop/README.md
    trunk/Master/texmf-dist/doc/latex/bibcop/bibcop.pdf
    trunk/Master/texmf-dist/scripts/bibcop/bibcop.pl
    trunk/Master/texmf-dist/source/latex/bibcop/bibcop.dtx
    trunk/Master/texmf-dist/tex/latex/bibcop/bibcop.sty
    trunk/Master/tlpkg/libexec/ctan2tds

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/man/man1/bibcop.1
    trunk/Master/texmf-dist/doc/man/man1/bibcop.man1.pdf

Modified: trunk/Build/source/texk/texlive/linked_scripts/bibcop/bibcop.pl
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/bibcop/bibcop.pl	2022-12-13 21:07:53 UTC (rev 65264)
+++ trunk/Build/source/texk/texlive/linked_scripts/bibcop/bibcop.pl	2022-12-13 21:08:43 UTC (rev 65265)
@@ -26,6 +26,9 @@
 use warnings;
 use strict;
 
+# Hash of incoming command line arguments.
+my %args = map { $_ => 1 } @ARGV;
+
 # If you want to add an extra check, just create a new procedure
 # named as "check_*".
 
@@ -237,6 +240,17 @@
   }
 }
 
+# Check the right format of the 'number.'
+sub check_number {
+  my (%item) = @_;
+  if (exists $item{'number'}) {
+    my $number = $item{'number'};
+    if (not $item{'number'} =~ /^[1-9][0-9]*$/) {
+      return "The format of the 'number' is wrong"
+    }
+  }
+}
+
 # Check the right format of the 'pages.'
 sub check_pages {
   my (%item) = @_;
@@ -387,8 +401,9 @@
 sub clean_tex {
   my ($tex) = @_;
   $tex =~ s/\s+/ /g;
-  $tex =~ s/^\{+//g;
-  $tex =~ s/\}+$//g;
+  $tex =~ s/^\s+//g;
+  $tex =~ s/\s+$//g;
+  while ($tex =~ s/^\{(.+)\}$/$1/g) {};
   return $tex;
 }
 
@@ -406,7 +421,32 @@
   return '(' . join(', ', @sorted) . ')';
 }
 
-my %args = map { $_ => 1 } @ARGV;
+# Print ERROR message to the console and die.
+sub error {
+  my ($txt) = @_;
+  print $txt . "\n";
+  exit 1;
+}
+
+# Print DEBUG message to the console.
+sub debug {
+  my ($txt) = @_;
+  if (exists $args{'--latex'}) {
+    print '% ';
+  }
+  print $txt . "\n";
+}
+
+# Print INFO message to the console.
+sub warning {
+  my ($txt) = @_;
+  if (exists $args{'--latex'}) {
+    print "\\PackageWarningNoLine{bibcop}{$txt}\n";
+  } else {
+    print $txt . "\n";
+  }
+}
+
 if (@ARGV+0 eq 0 or exists $args{'--help'}) {
   debug("Bibcop is a Style Checker of .bib Files\n" .
     "Usage: bibcop [<options>] <.bib file path>\n" .
@@ -415,7 +455,7 @@
     "  --fix     Fix the errors and print a new version of the .bib file to the console\n" .
     "  --latex   Report errors in LaTeX format using \\PackageWarningNoLine command");
 } elsif (exists $args{'--version'}) {
-  debug('0.0.2');
+  debug('0.0.3');
 } else {
   my ($file) = grep { not($_ =~ /^--.*$/) } @ARGV;
   open(my $fh, '<', $file);
@@ -463,30 +503,4 @@
   }
 }
 
-# Print ERROR message to the console and die.
-sub error {
-  my ($txt) = @_;
-  print $txt . "\n";
-  exit 1;
-}
-
-# Print DEBUG message to the console.
-sub debug {
-  my ($txt) = @_;
-  if (exists $args{'--latex'}) {
-    print '% ';
-  }
-  print $txt . "\n";
-}
-
-# Print INFO message to the console.
-sub warning {
-  my ($txt) = @_;
-  if (exists $args{'--latex'}) {
-    print "\\PackageWarningNoLine{bibcop}{$txt}\n";
-  } else {
-    print $txt . "\n";
-  }
-}
-
 1;

Modified: trunk/Master/texmf-dist/doc/latex/bibcop/DEPENDS.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/bibcop/DEPENDS.txt	2022-12-13 21:07:53 UTC (rev 65264)
+++ trunk/Master/texmf-dist/doc/latex/bibcop/DEPENDS.txt	2022-12-13 21:08:43 UTC (rev 65265)
@@ -1,3 +1,2 @@
 hard iexec
-hard fancyvrb
 hard verbatimcopy
\ No newline at end of file

Modified: trunk/Master/texmf-dist/doc/latex/bibcop/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/bibcop/README.md	2022-12-13 21:07:53 UTC (rev 65264)
+++ trunk/Master/texmf-dist/doc/latex/bibcop/README.md	2022-12-13 21:08:43 UTC (rev 65265)
@@ -1,4 +1,4 @@
-<img src="https://raw.githubusercontent.com/yegor256/bibcop/master/logo.svg" height="92px"/>
+<img src="https://raw.githubusercontent.com/yegor256/bibcop/master/bibcop-logo.svg" height="92px"/>
 
 [![l3build](https://github.com/yegor256/bibcop/actions/workflows/l3build.yml/badge.svg)](https://github.com/yegor256/bibcop/actions/workflows/l3build.yml)
 [![CTAN](https://img.shields.io/ctan/v/bibcop)](https://ctan.org/pkg/bibcop)
@@ -26,10 +26,11 @@
 
 You can also download [bibcop.pl](https://raw.githubusercontent.com/yegor256/bibcop/master/bibcop.pl)
 and use it as a command line tool
-to check your `.bib` files and to auto-fix them:
+to check your `.bib` files and to auto-fix them
+(you should have [Perl](https://www.perl.org) installed):
 
 ```
-$ ./bibcop.pl --fix main.bib > fixed.bib
+$ perl bibcop.pl --fix main.bib > fixed.bib
 ```
 
 This command will read the `main.bib` file and create `fixed.bib`, which
@@ -48,7 +49,7 @@
 When ready, run this, in order to check that all tests pass:
 
 ```bash
-$ ./tests.pl
+$ perl tests.pl
 ```
 
 You should see the `GREAT!` message.
\ No newline at end of file

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

Added: trunk/Master/texmf-dist/doc/man/man1/bibcop.1
===================================================================
--- trunk/Master/texmf-dist/doc/man/man1/bibcop.1	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/man/man1/bibcop.1	2022-12-13 21:08:43 UTC (rev 65265)
@@ -0,0 +1,29 @@
+.TH bibcop 1 "2022-12-13"
+.SH NAME
+bibcop \- Style Checker and Fixer of .bib Files
+.SH SYNOPSIS
+bibcop [<options>] <.bib file path>
+.SH DESCRIPTION
+The bibcop tool is a Perl script for checking the quality of .bib
+files and automatically fixing found inconsistencies. It is not only
+a command line tool, but a LaTeX package, which can check the quality
+of a .bib file during the rendering of a LaTeX document. All found
+issues are reported as LaTeX warnings.
+.SH OPTIONS
+Various options apply 
+.IP --version
+Print the version of the tool
+.IP --help
+Print the introduction screen
+.IP --fix
+Autho-fix all issues and print a new content to the console
+.IP --latex
+Print everything in LaTeX format
+.SH BUGS
+.SH AUTHOR
+Yegor Bugayenko (yegor256 at gmail.com)
+.PP
+Please log issues on the GitHub homepage:
+https://github.com/yegor256/bibcop/issues.
+.SH SEE ALSO
+See bibcop.pdf for more details.


Property changes on: trunk/Master/texmf-dist/doc/man/man1/bibcop.1
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/man/man1/bibcop.man1.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/man/man1/bibcop.man1.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/man/man1/bibcop.man1.pdf	2022-12-13 21:07:53 UTC (rev 65264)
+++ trunk/Master/texmf-dist/doc/man/man1/bibcop.man1.pdf	2022-12-13 21:08:43 UTC (rev 65265)

Property changes on: trunk/Master/texmf-dist/doc/man/man1/bibcop.man1.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Modified: trunk/Master/texmf-dist/scripts/bibcop/bibcop.pl
===================================================================
--- trunk/Master/texmf-dist/scripts/bibcop/bibcop.pl	2022-12-13 21:07:53 UTC (rev 65264)
+++ trunk/Master/texmf-dist/scripts/bibcop/bibcop.pl	2022-12-13 21:08:43 UTC (rev 65265)
@@ -26,6 +26,9 @@
 use warnings;
 use strict;
 
+# Hash of incoming command line arguments.
+my %args = map { $_ => 1 } @ARGV;
+
 # If you want to add an extra check, just create a new procedure
 # named as "check_*".
 
@@ -237,6 +240,17 @@
   }
 }
 
+# Check the right format of the 'number.'
+sub check_number {
+  my (%item) = @_;
+  if (exists $item{'number'}) {
+    my $number = $item{'number'};
+    if (not $item{'number'} =~ /^[1-9][0-9]*$/) {
+      return "The format of the 'number' is wrong"
+    }
+  }
+}
+
 # Check the right format of the 'pages.'
 sub check_pages {
   my (%item) = @_;
@@ -387,8 +401,9 @@
 sub clean_tex {
   my ($tex) = @_;
   $tex =~ s/\s+/ /g;
-  $tex =~ s/^\{+//g;
-  $tex =~ s/\}+$//g;
+  $tex =~ s/^\s+//g;
+  $tex =~ s/\s+$//g;
+  while ($tex =~ s/^\{(.+)\}$/$1/g) {};
   return $tex;
 }
 
@@ -406,7 +421,32 @@
   return '(' . join(', ', @sorted) . ')';
 }
 
-my %args = map { $_ => 1 } @ARGV;
+# Print ERROR message to the console and die.
+sub error {
+  my ($txt) = @_;
+  print $txt . "\n";
+  exit 1;
+}
+
+# Print DEBUG message to the console.
+sub debug {
+  my ($txt) = @_;
+  if (exists $args{'--latex'}) {
+    print '% ';
+  }
+  print $txt . "\n";
+}
+
+# Print INFO message to the console.
+sub warning {
+  my ($txt) = @_;
+  if (exists $args{'--latex'}) {
+    print "\\PackageWarningNoLine{bibcop}{$txt}\n";
+  } else {
+    print $txt . "\n";
+  }
+}
+
 if (@ARGV+0 eq 0 or exists $args{'--help'}) {
   debug("Bibcop is a Style Checker of .bib Files\n" .
     "Usage: bibcop [<options>] <.bib file path>\n" .
@@ -415,7 +455,7 @@
     "  --fix     Fix the errors and print a new version of the .bib file to the console\n" .
     "  --latex   Report errors in LaTeX format using \\PackageWarningNoLine command");
 } elsif (exists $args{'--version'}) {
-  debug('0.0.2');
+  debug('0.0.3');
 } else {
   my ($file) = grep { not($_ =~ /^--.*$/) } @ARGV;
   open(my $fh, '<', $file);
@@ -463,30 +503,4 @@
   }
 }
 
-# Print ERROR message to the console and die.
-sub error {
-  my ($txt) = @_;
-  print $txt . "\n";
-  exit 1;
-}
-
-# Print DEBUG message to the console.
-sub debug {
-  my ($txt) = @_;
-  if (exists $args{'--latex'}) {
-    print '% ';
-  }
-  print $txt . "\n";
-}
-
-# Print INFO message to the console.
-sub warning {
-  my ($txt) = @_;
-  if (exists $args{'--latex'}) {
-    print "\\PackageWarningNoLine{bibcop}{$txt}\n";
-  } else {
-    print $txt . "\n";
-  }
-}
-
 1;

Modified: trunk/Master/texmf-dist/source/latex/bibcop/bibcop.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/bibcop/bibcop.dtx	2022-12-13 21:07:53 UTC (rev 65264)
+++ trunk/Master/texmf-dist/source/latex/bibcop/bibcop.dtx	2022-12-13 21:08:43 UTC (rev 65265)
@@ -50,7 +50,7 @@
 %<package>\NeedsTeXFormat{LaTeX2e}
 %<package>\ProvidesPackage{bibcop}
 %<*package>
-[2022-12-12 0.0.2 Style Checker of Bibliography Files]
+[2022-12-13 0.0.3 Style Checker of Bibliography Files]
 %</package>
 %<*driver>
 \documentclass{ltxdoc}
@@ -105,7 +105,7 @@
 %\iffalse
 %</verb>
 %\fi
-% You may see warnings in the \TeX log. Fix the issues in the |main.bib| file
+% You may see warnings in the \TeX{} log --- fix the issues in the |main.bib| file
 % and the warnings will disappear.
 
 % If you use the |.sty| file (without installing it into the \TeX{} tree), don't forget
@@ -112,7 +112,8 @@
 % to also copy the |bibcop.pl| file --- it is the Perl script that does all the work
 % of checking your |.bib| files. The |.sty| is just a simple wrapper around it.
 
-% Make sure |\usepackage{bibcop}| stays before all other |\usepackage| commands, otherwise
+% Make sure |\usepackage{bibcop}| stays right after |\usepackage{biblatex}|
+% (if you use it), otherwise
 % you won't see any warnings from |bibcop|.
 
 % \section{The Rules}
@@ -132,7 +133,8 @@
 % Every bib item must have the |doi| key, which is a unique
 % \href{https://www.doi.org}{Digital Object Identifier}
 % of the material that you reference. It seems to be a good practice, in order to avoid ambiguity,
-% to always mention the DOI.
+% to always mention the DOI. I would also recommend to use \href{https://ctan.org/pkg/iexec}{doi} package,
+% in order to make all ``|doi|'' fields turned into hyper links.
 
 % \DescribeMacro{caps}
 % In |title|, |booktitle|, and |journal| keys, all major words must be capitalized,
@@ -149,6 +151,18 @@
 % Here, the leading ``|A|'' is capital because it opens the title.
 % The word ``|for|'' and the article ``|a|'' are minor words, that's why they are in lower case.
 % Both parts of the composite word ``|Data-Flow|'' are capitalized.
+% Sometimes you need to violate this rule and use custom capitalization, as it is done
+% by the author of the paper. In order to do this, wrap the words with custom capitalization
+% in curled brackets, for example:
+%\iffalse
+%<*verb>
+%\fi
+\begin{verbatim}
+title = {Structured Programming {with} Go {To} Statements}
+\end{verbatim}
+%\iffalse
+%</verb>
+%\fi
 
 % \DescribeMacro{author}
 % The |author| must contain a list of authors separated by ``|and|''. Each author
@@ -259,6 +273,18 @@
 %</verb>
 %\fi
 
+% \DescribeMacro{number}
+% The |number| may contain only a number:
+%\iffalse
+%<*verb>
+%\fi
+\begin{verbatim}
+number = {132},
+\end{verbatim}
+%\iffalse
+%</verb>
+%\fi
+
 % \DescribeMacro{pages}
 % The |pages| may contain either a number or two numbers separated by a double dash:
 %\iffalse
@@ -311,12 +337,14 @@
 % Then, we re-define the |\bibliography| command:
 %    \begin{macrocode}
 \makeatletter
-\ifdefined\bibliography\else\gdef\bibliography#1{}\fi
-\let\bibcop at oldbibliography\bibliography
-\renewcommand\bibliography[1]{%
-  \iexec{perl "./bibcop.tmp.pl" --latex '#1.bib'}%
-  \bibcop at oldbibliography{#1}%
-}
+\ifdefined\bibliography
+	\let\bibcop at oldbibliography\bibliography
+	\renewcommand\bibliography[1]{%
+	  \iexec{perl "./bibcop.tmp.pl" --latex '#1.bib'}%
+    \message{bibcop: style checking finished^^J}%
+	  \bibcop at oldbibliography{#1}%
+	}
+\fi
 \makeatother
 %    \end{macrocode}
 % \end{macro}
@@ -325,12 +353,14 @@
 % Then, we re-define the |\addbibresource| command:
 %    \begin{macrocode}
 \makeatletter
-\ifdefined\addbibresource\else\gdef\addbibresource#1{}\fi
-\let\bibcop at oldaddbibresource\addbibresource
-\renewcommand\addbibresource[1]{%
-  \iexec{perl "./bibcop.tmp.pl" --latex '#1'}%
-  \bibcop at oldaddbibresource{#1}%
-}
+\ifdefined\addbibresource
+	\let\bibcop at oldaddbibresource\addbibresource
+	\renewcommand\addbibresource[1]{%
+	  \iexec{perl "./bibcop.tmp.pl" --latex '#1'}%
+    \message{bibcop: style checking finished^^J}%
+	  \bibcop at oldaddbibresource{#1}%
+	}
+\fi
 \makeatother
 %    \end{macrocode}
 % \end{macro}

Modified: trunk/Master/texmf-dist/tex/latex/bibcop/bibcop.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/bibcop/bibcop.sty	2022-12-13 21:07:53 UTC (rev 65264)
+++ trunk/Master/texmf-dist/tex/latex/bibcop/bibcop.sty	2022-12-13 21:08:43 UTC (rev 65265)
@@ -31,7 +31,7 @@
 
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{bibcop}
-[2022-12-12 0.0.2 Style Checker of Bibliography Files]
+[2022-12-13 0.0.3 Style Checker of Bibliography Files]
 
 
 
@@ -53,6 +53,7 @@
 
 
 
+
 \RequirePackage{iexec}
 
 \RequirePackage{verbatimcopy}
@@ -60,21 +61,25 @@
 \message{bibcop: File with Perl script 'bibcop.pl' copied^^J}%
 
 \makeatletter
-\ifdefined\bibliography\else\gdef\bibliography#1{}\fi
+\ifdefined\bibliography
 \let\bibcop at oldbibliography\bibliography
 \renewcommand\bibliography[1]{%
   \iexec{perl "./bibcop.tmp.pl" --latex '#1.bib'}%
+    \message{bibcop: style checking finished^^J}%
   \bibcop at oldbibliography{#1}%
 }
+\fi
 \makeatother
 
 \makeatletter
-\ifdefined\addbibresource\else\gdef\addbibresource#1{}\fi
+\ifdefined\addbibresource
 \let\bibcop at oldaddbibresource\addbibresource
 \renewcommand\addbibresource[1]{%
   \iexec{perl "./bibcop.tmp.pl" --latex '#1'}%
+    \message{bibcop: style checking finished^^J}%
   \bibcop at oldaddbibresource{#1}%
 }
+\fi
 \makeatother
 
 

Modified: trunk/Master/tlpkg/libexec/ctan2tds
===================================================================
--- trunk/Master/tlpkg/libexec/ctan2tds	2022-12-13 21:07:53 UTC (rev 65264)
+++ trunk/Master/tlpkg/libexec/ctan2tds	2022-12-13 21:08:43 UTC (rev 65265)
@@ -3689,6 +3689,7 @@
  'a2ping'               => '\.1$',
  'axodraw2'		=> '\.1$',
  'bib2gls'		=> '\.1$',
+ 'bibcop'		=> '\.1$',
  'bundledoc'            => '\.1$',
  'chklref'		=> '\.1$',
  'citation-style-language' => '\.1$',



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