Skip to content

Commit

Permalink
#88 phdthesis allowed
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Apr 18, 2024
1 parent cc29d8a commit e930f56
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bibcop.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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?'],
);

Expand All @@ -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 =~ /^.*\?$/) {
Expand Down
7 changes: 7 additions & 0 deletions perl-tests/checking.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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) = @_;
Expand Down

0 comments on commit e930f56

Please sign in to comment.