Skip to content

Commit 33874ee

Browse files
committed
adjustments for loading in Contrib with bad tags
1 parent 02ed13c commit 33874ee

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

.github/workflows/bin/generate-OPL-tables.pl

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -260,17 +260,17 @@ sub safe_get_id {
260260
sub isvalid {
261261
my $tags = shift;
262262
if (!defined $taxo->{ $tags->{DBsubject} }) {
263-
print "\nInvalid subject $tags->{DBsubject}\n";
263+
#print "\nInvalid subject $tags->{DBsubject}\n";
264264
return 0;
265265
}
266266
if (!($tags->{DBchapter} eq 'Misc.') && !defined $taxo->{ $tags->{DBsubject} }{ $tags->{DBchapter} }) {
267-
print "\nInvalid chapter $tags->{DBchapter}\n";
267+
#print "\nInvalid chapter $tags->{DBchapter}\n";
268268
return 0;
269269
}
270270
if (!($tags->{DBsection} eq 'Misc.')
271271
&& !defined $taxo->{ $tags->{DBsubject} }{ $tags->{DBchapter} }{ $tags->{DBsection} })
272272
{
273-
print "\nInvalid section $tags->{DBsection}\n";
273+
#print "\nInvalid section $tags->{DBsection}\n";
274274
return 0;
275275
}
276276
return 1;
@@ -519,8 +519,9 @@ sub pgfiles {
519519

520520
if ($tags->istagged()) {
521521
# Fill in missing data with Misc. instead of blank
522-
print "\nNO SUBJECT $name\n" unless ($tags->{DBsubject} =~ /\S/);
522+
#print "\nNO SUBJECT $name\n" unless ($tags->{DBsubject} =~ /\S/);
523523

524+
$tags->{DBsubject} = 'Misc.' unless $tags->{DBchapter} =~ /\S/;
524525
$tags->{DBchapter} = 'Misc.' unless $tags->{DBchapter} =~ /\S/;
525526
$tags->{DBsection} = 'Misc.' unless $tags->{DBsection} =~ /\S/;
526527

@@ -564,7 +565,7 @@ sub pgfiles {
564565
}
565566
} else {
566567
# Tags are not valid, error printed by validation part.
567-
print "File $name\n";
568+
#print "File $name\n";
568569
next;
569570
}
570571

@@ -615,17 +616,15 @@ sub pgfiles {
615616
my $path_id = safe_get_id($tables{path}, 'path_id', qq(WHERE path = ?), [$pgpath], 1, '', $pgpath, '', '');
616617

617618
# pgfile table -- set 4 defaults first
618-
619-
# TODO this is where we have to deal with crosslists, and pgfileid will be an array of id's
620-
# Make an array of DBsection-id's above
621-
my $level = $tags->{Level} || 0;
622-
# Default language is English
619+
my $level = ($tags->{Level} =~ /\d/) ? $tags->{Level} || 0;
623620
my $lang = $tags->{Language} || 'en';
624621
my $mathobj = $tags->{MO} || 0;
625622
my $static = $tags->{Static} || 0;
626623

627-
my @pgfile_ids;
628624

625+
# TODO this is where we have to deal with crosslists, and pgfileid will be an array of id's
626+
# Make an array of DBsection-id's above
627+
my @pgfile_ids;
629628
for my $DBsection_id (@DBsection_ids) {
630629
my $pgfile_id = safe_get_id(
631630
$tables{pgfile}, 'pgfile_id',

0 commit comments

Comments
 (0)