diff options
-rwxr-xr-x | Build/source/texk/texlive/linked_scripts/bibcop/bibcop.pl | 68 | ||||
-rw-r--r-- | Master/texmf-dist/doc/bibtex/bibcop/README.md | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/bibtex/bibcop/bibcop.pdf | bin | 343404 -> 347218 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/man/man1/bibcop.1 | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/man/man1/bibcop.man1.pdf | bin | 13270 -> 13411 bytes | |||
-rwxr-xr-x | Master/texmf-dist/scripts/bibcop/bibcop.pl | 68 | ||||
-rw-r--r-- | Master/texmf-dist/source/bibtex/bibcop/bibcop.dtx | 60 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/bibcop/bibcop.sty | 34 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkg-ctan-check | 2 | ||||
-rwxr-xr-x | Master/tlpkg/libexec/ctan2tds | 1 |
10 files changed, 186 insertions, 51 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/bibcop/bibcop.pl b/Build/source/texk/texlive/linked_scripts/bibcop/bibcop.pl index cfe8e3ac476..178e0047bb3 100755 --- a/Build/source/texk/texlive/linked_scripts/bibcop/bibcop.pl +++ b/Build/source/texk/texlive/linked_scripts/bibcop/bibcop.pl @@ -44,6 +44,9 @@ my %minors = map { $_ => 1 } qw/in of at to by the a an and or as if up via yet # Check the presence of mandatory tags. sub check_mandatory_tags { + if (exists $args{'--no:tags'}) { + return; + } my (%entry) = @_; my $type = $entry{':type'}; my $mandatory = $blessed{$type}; @@ -71,6 +74,9 @@ sub check_mandatory_tags { # Check that all major words are capitalized. sub check_capitalization { + if (exists $args{'--no:caps'}) { + return; + } my (%entry) = @_; my %tags = map { $_ => 1 } qw/title booktitle journal publisher organization/; foreach my $tag (keys %entry) { @@ -101,14 +107,21 @@ sub check_capitalization { # Check that the 'author' is formatted correctly. sub check_author { my (%entry) = @_; - if (exists $entry{'author'} and not $entry{'author'} =~ /^\{.+\}$/) { - my $author = clean_tex($entry{'author'}); - if (not $author =~ /^[A-Z][^ ]+(,( [A-Z][^ ]+)+)?( and [A-Z][^ ]+(,( [A-Z][^ ]+)+)?)*( and others)?$/) { - return "The format of the 'author' is wrong, use something like 'Knuth, Donald E. and Duane, Bibby'" - } - if ($author =~ /.*[A-Z]([ ,]|$).*/) { - return "A shortened name must have a tailing dot, as in 'Knuth, Donald E.'" - } + if (not exists $entry{'author'}) { + return; + } + if ($entry{'author'} =~ /^\{.+\}$/) { + return; + } + my $author = clean_tex($entry{'author'}); + if (index($author, '{') != -1) { + return; + } + if (not $author =~ /^[A-Z][^ ]+(,( [A-Z][^ ]+)+)?( and [A-Z][^ ]+(,( [A-Z][^ ]+)+)?)*( and others)?$/) { + return "The format of the 'author' is wrong, use something like 'Knuth, Donald E. and Duane, Bibby'" + } + if ($author =~ /.*[A-Z]([ ,]|$).*/) { + return "A shortened name must have a tailing dot, as in 'Knuth, Donald E.'" } } @@ -134,7 +147,10 @@ sub check_shortenings { } # Check the right format of the 'title' and 'booktitle.' -sub check_titles { +sub check_wrapping { + if (exists $args{'--no:wraps'}) { + return; + } my (%entry) = @_; my @tags = qw/title booktitle/; foreach my $tag (@tags) { @@ -177,6 +193,9 @@ sub check_arXiv { # Check that organization is not mentioned in the booktitle. sub check_org_in_booktitle { + if (exists $args{'--no:org'}) { + return; + } my (%entry) = @_; my @orgs = ( 'ACM', 'IEEE' ); if (exists($entry{'booktitle'})) { @@ -311,6 +330,9 @@ sub check_year_in_titles { # Check the right format of the 'booktitle' in the 'inproceedings' entry. sub check_booktile_of_inproceedings { + if (exists $args{'--no:inproc'}) { + return; + } my (%entry) = @_; my $tag = 'inproceedings'; if ($entry{':type'} eq $tag) { @@ -325,6 +347,9 @@ sub check_booktile_of_inproceedings { # Check the right format of the 'doi.' sub check_doi { + if (exists $args{'--no:doi'}) { + return; + } my (%entry) = @_; if (exists $entry{'doi'}) { my $doi = $entry{'doi'}; @@ -339,8 +364,14 @@ sub check_year { my (%entry) = @_; if (exists $entry{'year'}) { my $year = $entry{'year'}; - if (not $year =~ /^[0-9]{3,4}$/) { - return "The format of the 'year' is wrong" + if ($year =~ /^\{.+\}$/) { + return; + } + if (not $year =~ /^[0-9]+$/) { + return "The format of the 'year' is wrong, may only contain numbers or must be wrapped in curly braces" + } + if (not $year =~ /^[0-9]{4}$/) { + return "Exactly four digits must be present in the 'year', or it must be wrapped in curly braces" } } } @@ -391,8 +422,8 @@ sub check_pages { if ($parts[0] eq $parts[1]) { return "The 'pages' mentions the same page twice, just use it once" } - if ($parts[0] gt $parts[1]) { - return "The 'pages' are in the wrong order" + if ($parts[0] > $parts[1]) { + return "The 'pages' are in the wrong order, since $parts[0] is greater than $parts[1]" } } } @@ -429,7 +460,7 @@ sub process_entry { foreach my $check (@sorted) { no strict 'refs'; my $err = $check->(%entry); - if ($err ne '') { + if (defined $err and $err ne '') { push(@errors, $err); } } @@ -724,10 +755,17 @@ if (@ARGV+0 eq 0 or exists $args{'--help'} or exists $args{'-?'}) { " -?, --help Print this help screen\n" . " --fix Fix the errors and print a new version of the .bib file to the console\n" . " --verbose Print supplementary debugging information\n" . + " --no:XXX Disable one of the following checks (e.g. --no:wraps):\n" . + " tags Only some tags are allowed, while some of them are mandatory\n" . + " caps All major words in titles and booktitles must be capitalized\n" . + " wraps Double curly braces are required around titles and booktitles\n" . + " doi The presence of the 'doi' tag is mandatory in all entries\n" . + " inproc The booktitle of \@inproceedings must start with 'Proceedings of the'\n" . + " org The booktitle may not mention ACM or IEEE\n" . " --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.10'); + info('0.0.11'); } else { my ($file) = grep { not($_ =~ /^--.*$/) } @ARGV; if (not $file) { diff --git a/Master/texmf-dist/doc/bibtex/bibcop/README.md b/Master/texmf-dist/doc/bibtex/bibcop/README.md index cda41a8ddd9..350660b169f 100644 --- a/Master/texmf-dist/doc/bibtex/bibcop/README.md +++ b/Master/texmf-dist/doc/bibtex/bibcop/README.md @@ -12,7 +12,7 @@ they do _almost_ the same but from the command line. First, [install it](https://en.wikibooks.org/wiki/LaTeX/Installing_Extra_Packages) from [CTAN](https://ctan.org/pkg/bibcop) -and then use in the preamble (if you use BibTeX, for example): +and then use in the preamble (if you use [BibTeX](http://www.bibtex.org/), for example): ```tex \documentclass{article} diff --git a/Master/texmf-dist/doc/bibtex/bibcop/bibcop.pdf b/Master/texmf-dist/doc/bibtex/bibcop/bibcop.pdf Binary files differindex be16c4e36da..feaa27f284f 100644 --- a/Master/texmf-dist/doc/bibtex/bibcop/bibcop.pdf +++ b/Master/texmf-dist/doc/bibtex/bibcop/bibcop.pdf diff --git a/Master/texmf-dist/doc/man/man1/bibcop.1 b/Master/texmf-dist/doc/man/man1/bibcop.1 index 93e3ccd28ea..85a0e540995 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-05-16" +.TH bibcop 1 "2023-05-18" .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 Binary files differindex 04694d02be6..546bd1014f7 100644 --- a/Master/texmf-dist/doc/man/man1/bibcop.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/bibcop.man1.pdf diff --git a/Master/texmf-dist/scripts/bibcop/bibcop.pl b/Master/texmf-dist/scripts/bibcop/bibcop.pl index cfe8e3ac476..178e0047bb3 100755 --- a/Master/texmf-dist/scripts/bibcop/bibcop.pl +++ b/Master/texmf-dist/scripts/bibcop/bibcop.pl @@ -44,6 +44,9 @@ my %minors = map { $_ => 1 } qw/in of at to by the a an and or as if up via yet # Check the presence of mandatory tags. sub check_mandatory_tags { + if (exists $args{'--no:tags'}) { + return; + } my (%entry) = @_; my $type = $entry{':type'}; my $mandatory = $blessed{$type}; @@ -71,6 +74,9 @@ sub check_mandatory_tags { # Check that all major words are capitalized. sub check_capitalization { + if (exists $args{'--no:caps'}) { + return; + } my (%entry) = @_; my %tags = map { $_ => 1 } qw/title booktitle journal publisher organization/; foreach my $tag (keys %entry) { @@ -101,14 +107,21 @@ sub check_capitalization { # Check that the 'author' is formatted correctly. sub check_author { my (%entry) = @_; - if (exists $entry{'author'} and not $entry{'author'} =~ /^\{.+\}$/) { - my $author = clean_tex($entry{'author'}); - if (not $author =~ /^[A-Z][^ ]+(,( [A-Z][^ ]+)+)?( and [A-Z][^ ]+(,( [A-Z][^ ]+)+)?)*( and others)?$/) { - return "The format of the 'author' is wrong, use something like 'Knuth, Donald E. and Duane, Bibby'" - } - if ($author =~ /.*[A-Z]([ ,]|$).*/) { - return "A shortened name must have a tailing dot, as in 'Knuth, Donald E.'" - } + if (not exists $entry{'author'}) { + return; + } + if ($entry{'author'} =~ /^\{.+\}$/) { + return; + } + my $author = clean_tex($entry{'author'}); + if (index($author, '{') != -1) { + return; + } + if (not $author =~ /^[A-Z][^ ]+(,( [A-Z][^ ]+)+)?( and [A-Z][^ ]+(,( [A-Z][^ ]+)+)?)*( and others)?$/) { + return "The format of the 'author' is wrong, use something like 'Knuth, Donald E. and Duane, Bibby'" + } + if ($author =~ /.*[A-Z]([ ,]|$).*/) { + return "A shortened name must have a tailing dot, as in 'Knuth, Donald E.'" } } @@ -134,7 +147,10 @@ sub check_shortenings { } # Check the right format of the 'title' and 'booktitle.' -sub check_titles { +sub check_wrapping { + if (exists $args{'--no:wraps'}) { + return; + } my (%entry) = @_; my @tags = qw/title booktitle/; foreach my $tag (@tags) { @@ -177,6 +193,9 @@ sub check_arXiv { # Check that organization is not mentioned in the booktitle. sub check_org_in_booktitle { + if (exists $args{'--no:org'}) { + return; + } my (%entry) = @_; my @orgs = ( 'ACM', 'IEEE' ); if (exists($entry{'booktitle'})) { @@ -311,6 +330,9 @@ sub check_year_in_titles { # Check the right format of the 'booktitle' in the 'inproceedings' entry. sub check_booktile_of_inproceedings { + if (exists $args{'--no:inproc'}) { + return; + } my (%entry) = @_; my $tag = 'inproceedings'; if ($entry{':type'} eq $tag) { @@ -325,6 +347,9 @@ sub check_booktile_of_inproceedings { # Check the right format of the 'doi.' sub check_doi { + if (exists $args{'--no:doi'}) { + return; + } my (%entry) = @_; if (exists $entry{'doi'}) { my $doi = $entry{'doi'}; @@ -339,8 +364,14 @@ sub check_year { my (%entry) = @_; if (exists $entry{'year'}) { my $year = $entry{'year'}; - if (not $year =~ /^[0-9]{3,4}$/) { - return "The format of the 'year' is wrong" + if ($year =~ /^\{.+\}$/) { + return; + } + if (not $year =~ /^[0-9]+$/) { + return "The format of the 'year' is wrong, may only contain numbers or must be wrapped in curly braces" + } + if (not $year =~ /^[0-9]{4}$/) { + return "Exactly four digits must be present in the 'year', or it must be wrapped in curly braces" } } } @@ -391,8 +422,8 @@ sub check_pages { if ($parts[0] eq $parts[1]) { return "The 'pages' mentions the same page twice, just use it once" } - if ($parts[0] gt $parts[1]) { - return "The 'pages' are in the wrong order" + if ($parts[0] > $parts[1]) { + return "The 'pages' are in the wrong order, since $parts[0] is greater than $parts[1]" } } } @@ -429,7 +460,7 @@ sub process_entry { foreach my $check (@sorted) { no strict 'refs'; my $err = $check->(%entry); - if ($err ne '') { + if (defined $err and $err ne '') { push(@errors, $err); } } @@ -724,10 +755,17 @@ if (@ARGV+0 eq 0 or exists $args{'--help'} or exists $args{'-?'}) { " -?, --help Print this help screen\n" . " --fix Fix the errors and print a new version of the .bib file to the console\n" . " --verbose Print supplementary debugging information\n" . + " --no:XXX Disable one of the following checks (e.g. --no:wraps):\n" . + " tags Only some tags are allowed, while some of them are mandatory\n" . + " caps All major words in titles and booktitles must be capitalized\n" . + " wraps Double curly braces are required around titles and booktitles\n" . + " doi The presence of the 'doi' tag is mandatory in all entries\n" . + " inproc The booktitle of \@inproceedings must start with 'Proceedings of the'\n" . + " org The booktitle may not mention ACM or IEEE\n" . " --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.10'); + info('0.0.11'); } else { my ($file) = grep { not($_ =~ /^--.*$/) } @ARGV; if (not $file) { diff --git a/Master/texmf-dist/source/bibtex/bibcop/bibcop.dtx b/Master/texmf-dist/source/bibtex/bibcop/bibcop.dtx index a1a5a08c99f..d29137b21bc 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-05-16 0.0.10 Style Checker of Bibliography Files] +[2023-05-18 0.0.11 Style Checker of Bibliography Files] %</package> %<*driver> \documentclass{ltxdoc} @@ -149,6 +149,27 @@ %</verb> %\fi +% \DescribeMacro{no*} +% It's possible to suppress certain rules, by using one of the |no*| package options: +%\iffalse +%<*verb> +%\fi +\begin{verbatim} +\usepackage[nodoi,nowraps]{bibcop} +\end{verbatim} +%\iffalse +%</verb> +%\fi +% The following options are available: +% \begin{itemize}\setlength\itemsep{0pt} +% \item |nocaps| allows arbitrary capitalization in titles; +% \item |nowraps| allows titles to have no double curly braces; +% \item |nodoi| allows the absence of the |doi| tag in all entries; +% \item |noinproc| allows the |booktitle| tag in |@inproceedings| entries to not start with ``Proceedings of the''; +% \item |noorg| allows mentioning of ACM/IEEE in the |booktitle| tag; +% \item |notags| allows any tags and allow to miss important tags. +% \end{itemize} + % \section{The Rules} % This is a more or less complete list of rules enforced on a |.bib| file: @@ -197,6 +218,7 @@ title = {Structured Programming {with} Go {To} Statements} %\iffalse %</verb> %\fi +% This rule may be disabled by the |nocaps| package option. % \DescribeMacro{author} % The |author| must contain a list of authors separated by ``|and|''. Each author @@ -354,6 +376,7 @@ booktitle = {{Proceedings of the International %\iffalse %</verb> %\fi +% This rule may be disabled by the |noinproc| package option. % \DescribeMacro{arXiv} % If the |archivePrefix| is present, the |eprint| and the |primaryClass| must also be present and must adhere to the formatting principles of \href{https://arxiv.org/help/arxiv_identifier}{arXiv identifiers}: @@ -403,6 +426,12 @@ booktitle = {{Proceedings of the International \RequirePackage{pgfopts} \pgfkeys{ /bibcop/.cd, + notags/.store in=\bibcop@notags, + noorg/.store in=\bibcop@noorg, + noinproc/.store in=\bibcop@noinproc, + nocaps/.store in=\bibcop@nocaps, + nodoi/.store in=\bibcop@nodoi, + nowraps/.store in=\bibcop@nowraps, verbose/.store in=\bibcop@verbose, script/.store in = \bibcop@script, } @@ -423,6 +452,25 @@ booktitle = {{Proceedings of the International % \end{macrocode} % \end{macro} +% \begin{macro}{\bibcop@exec} +% Then, we define a supplementary command to execute the Perl script: +% \begin{macrocode} +\makeatletter +\newcommand\bibcop@exec[1]{ + \iexec{\bibcop@script\space + \ifdefined\bibcop@verbose--verbose\fi\space + \ifdefined\bibcop@notags--no:tags\fi\space + \ifdefined\bibcop@noinproc--no:org\fi\space + \ifdefined\bibcop@noinproc--no:inproc\fi\space + \ifdefined\bibcop@nodoi--no:doi\fi\space + \ifdefined\bibcop@nocaps--no:caps\fi\space + \ifdefined\bibcop@nowraps--no:wraps\fi\space + --latex '#1'}% + \message{bibcop: style checking finished for #1^^J}% +} +\makeatother + + % \begin{macro}{\bibliography} % Then, we re-define the |\bibliography| command: % \begin{macrocode} @@ -430,10 +478,7 @@ booktitle = {{Proceedings of the International \ifdefined\bibliography \let\bibcop@oldbibliography\bibliography \renewcommand\bibliography[1]{% - \iexec{\bibcop@script\space - \ifdefined\bibcop@verbose--verbose\fi\space - --latex '#1.bib'}% - \message{bibcop: style checking finished^^J}% + \bibcop@exec{#1.bib}% \bibcop@oldbibliography{#1}% } \fi @@ -448,10 +493,7 @@ booktitle = {{Proceedings of the International \ifdefined\addbibresource \let\bibcop@oldaddbibresource\addbibresource \renewcommand\addbibresource[1]{% - \iexec{\bibcop@script\space - \ifdefined\bibcop@verbose--verbose\fi\space - --latex '#1'}% - \message{bibcop: style checking finished^^J}% + \bibcop@exec{#1}% \bibcop@oldaddbibresource{#1}% } \fi diff --git a/Master/texmf-dist/tex/latex/bibcop/bibcop.sty b/Master/texmf-dist/tex/latex/bibcop/bibcop.sty index ccc02e1854c..7ee506ca157 100644 --- a/Master/texmf-dist/tex/latex/bibcop/bibcop.sty +++ b/Master/texmf-dist/tex/latex/bibcop/bibcop.sty @@ -31,7 +31,8 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{bibcop} -[2023-05-16 0.0.10 Style Checker of Bibliography Files] +[2023-05-18 0.0.11 Style Checker of Bibliography Files] + @@ -67,6 +68,12 @@ \RequirePackage{pgfopts} \pgfkeys{ /bibcop/.cd, + notags/.store in=\bibcop@notags, + noorg/.store in=\bibcop@noorg, + noinproc/.store in=\bibcop@noinproc, + nocaps/.store in=\bibcop@nocaps, + nodoi/.store in=\bibcop@nodoi, + nowraps/.store in=\bibcop@nowraps, verbose/.store in=\bibcop@verbose, script/.store in = \bibcop@script, } @@ -82,13 +89,25 @@ \makeatother \makeatletter +\newcommand\bibcop@exec[1]{ + \iexec{\bibcop@script\space + \ifdefined\bibcop@verbose--verbose\fi\space + \ifdefined\bibcop@notags--no:tags\fi\space + \ifdefined\bibcop@noinproc--no:org\fi\space + \ifdefined\bibcop@noinproc--no:inproc\fi\space + \ifdefined\bibcop@nodoi--no:doi\fi\space + \ifdefined\bibcop@nocaps--no:caps\fi\space + \ifdefined\bibcop@nowraps--no:wraps\fi\space + --latex '#1'}% + \message{bibcop: style checking finished for #1^^J}% +} +\makeatother + +\makeatletter \ifdefined\bibliography \let\bibcop@oldbibliography\bibliography \renewcommand\bibliography[1]{% - \iexec{\bibcop@script\space - \ifdefined\bibcop@verbose--verbose\fi\space - --latex '#1.bib'}% - \message{bibcop: style checking finished^^J}% + \bibcop@exec{#1.bib}% \bibcop@oldbibliography{#1}% } \fi @@ -98,10 +117,7 @@ \ifdefined\addbibresource \let\bibcop@oldaddbibresource\addbibresource \renewcommand\addbibresource[1]{% - \iexec{\bibcop@script\space - \ifdefined\bibcop@verbose--verbose\fi\space - --latex '#1'}% - \message{bibcop: style checking finished^^J}% + \bibcop@exec{#1}% \bibcop@oldaddbibresource{#1}% } \fi diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index c1d392f171e..aea932b6ff8 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -216,7 +216,7 @@ my @TLP_working = qw( context-gantt context-gnuplot context-handlecsv context-layout context-letter context-lettrine context-mathsets context-notes-zh-cn context-pocketdiary context-rst context-ruby - context-simplefonts context-simpleslides context-title + context-simplefonts context-simpleslides context-sudoku context-title context-transliterator context-typearea context-typescripts context-vim context-visualcounter continue contour contracard conv-xkv convbkmk diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index 1109f1375b1..e20caec2085 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -373,6 +373,7 @@ chomp (my $ctan_root = `tlpkginfo --ctan-root`); 'context-sgf', "die 'skipping, obsolete per author'", 'context-simplefonts', "&MAKEcopy", 'context-simpleslides',"&MAKEcopy", + 'context-sudoku', "&MAKEcopy", 'context-taspresent', "&MAKEcopy", 'context-texlive', "die 'skipping, maintained in TL, see .tlpsrc'", 'context-title', "&MAKEcopy", |