diff --git a/bibcop.pl b/bibcop.pl index 467a32a..3cf9e49 100755 --- a/bibcop.pl +++ b/bibcop.pl @@ -40,6 +40,7 @@ package bibcop; 'article' => ['doi', 'year', 'title', 'author', 'journal', 'volume', 'number', 'month?', 'publisher?', 'pages?'], 'inproceedings' => ['doi', 'booktitle', 'title', 'author', 'year', 'pages?', 'month?', 'organization?', 'volume?'], 'book' => ['title', 'author', 'year', 'publisher', 'doi?'], + 'phdthesis' => ['title', 'author', 'year', 'school', 'doi?'], 'misc' => ['title', 'author', 'year', 'eprint?', 'archiveprefix?', 'primaryclass?', 'month?', 'publisher?', 'organization?', 'doi?', 'howpublished?', 'note?', 'pages?', 'number?', 'volume?'], ); @@ -53,6 +54,9 @@ sub check_mandatory_tags { } my (%entry) = @_; my $type = $entry{':type'}; + if (not exists $blessed{$type}) { + return "The type of entry is not allowed: '$type'" + } my $mandatory = $blessed{$type}; foreach my $tag (@$mandatory) { if ($tag =~ /^.*\?$/) { diff --git a/perl-tests/checking.pl b/perl-tests/checking.pl index 4a42581..f56cf57 100755 --- a/perl-tests/checking.pl +++ b/perl-tests/checking.pl @@ -93,6 +93,13 @@ package bibcop; 'howpublished' => '\\url{https://www.yegor256.com}', 'note' => 'it is a blog post' )); +passes(( + ':type' => 'phdthesis', + 'author' => 'Doe, John', + 'title' => '{The Title}', + 'year' => '1984', + 'school' => 'Stanford' +)); sub fails { my (%entry) = @_;