summaryrefslogtreecommitdiff
path: root/biblio/bibtex/utils/bibcop
diff options
context:
space:
mode:
Diffstat (limited to 'biblio/bibtex/utils/bibcop')
-rw-r--r--biblio/bibtex/utils/bibcop/README.md1
-rw-r--r--biblio/bibtex/utils/bibcop/bibcop.12
-rw-r--r--biblio/bibtex/utils/bibcop/bibcop.dtx2
-rw-r--r--biblio/bibtex/utils/bibcop/bibcop.pdfbin343290 -> 343290 bytes
-rwxr-xr-xbiblio/bibtex/utils/bibcop/bibcop.pl29
5 files changed, 22 insertions, 12 deletions
diff --git a/biblio/bibtex/utils/bibcop/README.md b/biblio/bibtex/utils/bibcop/README.md
index 471c4dcdcb..cda41a8ddd 100644
--- a/biblio/bibtex/utils/bibcop/README.md
+++ b/biblio/bibtex/utils/bibcop/README.md
@@ -36,6 +36,7 @@ $ perl bibcop.pl --fix main.bib > fixed.bib
This command will read the `main.bib` file and create `fixed.bib`, which
will have the fixed and properly formatted content (well, to some extent).
+Be careful, all comments will be removed.
If you install the package using [`tlmgr`](https://www.tug.org/texlive/tlmgr.html),
you should be able to use `bibcop` directly, without the necessity to mention Perl:
diff --git a/biblio/bibtex/utils/bibcop/bibcop.1 b/biblio/bibtex/utils/bibcop/bibcop.1
index 48f55428ed..19bb874117 100644
--- a/biblio/bibtex/utils/bibcop/bibcop.1
+++ b/biblio/bibtex/utils/bibcop/bibcop.1
@@ -1,4 +1,4 @@
-.TH bibcop 1 "2023-01-29"
+.TH bibcop 1 "2023-02-13"
.SH NAME
bibcop \- Style Checker and Fixer of BibTeX Files (.bib)
.SH SYNOPSIS
diff --git a/biblio/bibtex/utils/bibcop/bibcop.dtx b/biblio/bibtex/utils/bibcop/bibcop.dtx
index d3b34027c7..e688e2379e 100644
--- a/biblio/bibtex/utils/bibcop/bibcop.dtx
+++ b/biblio/bibtex/utils/bibcop/bibcop.dtx
@@ -50,7 +50,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{bibcop}
%<*package>
-[2023-01-29 0.0.8 Style Checker of Bibliography Files]
+[2023-02-13 0.0.9 Style Checker of Bibliography Files]
%</package>
%<*driver>
\documentclass{ltxdoc}
diff --git a/biblio/bibtex/utils/bibcop/bibcop.pdf b/biblio/bibtex/utils/bibcop/bibcop.pdf
index 29fb6056bb..09a4e1e5d0 100644
--- a/biblio/bibtex/utils/bibcop/bibcop.pdf
+++ b/biblio/bibtex/utils/bibcop/bibcop.pdf
Binary files differ
diff --git a/biblio/bibtex/utils/bibcop/bibcop.pl b/biblio/bibtex/utils/bibcop/bibcop.pl
index fd774d9019..eb337fc365 100755
--- a/biblio/bibtex/utils/bibcop/bibcop.pl
+++ b/biblio/bibtex/utils/bibcop/bibcop.pl
@@ -36,7 +36,7 @@ my %args = map { $_ => 1 } @ARGV;
my %blessed = (
'article' => ['doi', 'year', 'title', 'author', 'journal', 'volume', 'number', 'publisher?', 'pages?'],
'inproceedings' => ['doi', 'booktitle', 'title', 'author', 'year', 'pages?', 'organization?', 'volume?'],
- 'book' => ['doi', 'title', 'author', 'year', 'publisher'],
+ 'book' => ['title', 'author', 'year', 'publisher', 'doi?'],
'misc' => ['title', 'author', 'year', 'eprint?', 'archiveprefix?', 'primaryclass?', 'publisher?', 'organization?', 'doi?', 'url?'],
);
@@ -232,38 +232,47 @@ sub check_typography {
}
foreach my $s (@no_space_before) {
if ($value =~ /^.*\s\Q$s\E.*$/) {
- return "In the '$tag', do not put a space before a $symbols{$s}"
+ return "In the '$tag', do not put a space before the $symbols{$s}"
}
}
foreach my $s (@no_space_after) {
if ($value =~ /^.*\Q$s\E\s.*$/) {
- return "In the '$tag', do not put a space after a $symbols{$s}"
+ return "In the '$tag', do not put a space after the $symbols{$s}"
}
}
foreach my $s (@space_before) {
if ($value =~ /^.*[^\s]\Q$s\E.*$/) {
- return "In the '$tag', put a space before a $symbols{$s}"
+ 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].*$/) {
- return "In the '$tag', put a space after a $symbols{$s}"
+ return "In the '$tag', put a space after the $symbols{$s}"
}
}
foreach my $s (@spaces_around) {
if ($value =~ /^.*[^\s]\Q$s\E.*$/ or $value =~ /^.*\Q$s\E[^\s].*$/) {
- return "In the '$tag', put spaces around a $symbols{$s}"
+ return "In the '$tag', put spaces around the $symbols{$s}"
}
}
foreach my $s (@no_spaces_around) {
if ($value =~ /^.*\s\Q$s\E\s.*$/) {
- return "In the '$tag', don't put spaces around a $symbols{$s}"
+ return "In the '$tag', don't put spaces around the $symbols{$s}"
}
}
}
}
+# Check that the type is small letters.
+sub check_type_capitalization {
+ my (%entry) = @_;
+ my $type = $entry{':type'};
+ if (not $type =~ /^[a-z]+$/) {
+ return "The type '$type' must be lower-cased"
+ }
+}
+
# Check that no values have non-ASCII symbols.
sub check_ascii {
my (%entry) = @_;
@@ -463,7 +472,7 @@ sub entries {
warning("Each BibTeX entry must start with '\@', what is '$char'?");
last;
}
- } elsif ($char =~ /[a-z]/ and $s eq 'start') {
+ } elsif ($char =~ /[a-zA-Z]/ and $s eq 'start') {
# @article
} elsif ($char eq '{' and $s eq 'start') {
$entry{':type'} = substr($acc, 1);
@@ -472,7 +481,7 @@ sub entries {
} elsif ($char =~ /[a-zA-Z0-9]/ and $s eq 'body') {
$acc = '';
$s = 'tag';
- } elsif ($char =~ /[a-zA-Z0-9_\.\-\/]/ and $s eq 'tag') {
+ } elsif ($char =~ /[a-zA-Z0-9_\.\-\/:]/ and $s eq 'tag') {
# reading the tag
} elsif ($char =~ /[a-zA-Z0-9]/ and $s eq 'value') {
# reading the value without quotes or brackets
@@ -631,7 +640,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.8');
+ info('0.0.9');
} else {
my ($file) = grep { not($_ =~ /^--.*$/) } @ARGV;
if (not $file) {