Skip to content

Commit

Permalink
add first pb if missing, add pb/@id if missing
Browse files Browse the repository at this point in the history
  • Loading branch information
matyaskopp committed Jun 4, 2024
1 parent 2ba11b4 commit 9d3d558
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Scripts/parlamint2teitok.pl
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,22 @@
};
};

# add first page begin if missing
my ($firstelem) = @{$xml->findnodes("//text/body/div[1]/*[not(name() = 'gap')]")};
print STDERR $firstelem->toString;
if ($firstelem && ($firstelem->getName() ne 'pb') ) {
my $pb = $xml->createElement("pb");
$pb->setAttribute("n", 0);
$pb->setAttribute("type", "pagination");
$firstelem->parentNode->insertBefore($pb, $firstelem);
}

# add ids page begin if missing
my $pbcnt = 0;
foreach my $pb ( $xml->findnodes("//text//pb[not(\@xml:id)]") ) {
$pbcnt++;
$pb->setAttribute("id", "pb-$pbcnt");
};

} else {
$dcnt = 0; $pbcnt = 0; $scnt = 1;
Expand Down

0 comments on commit 9d3d558

Please sign in to comment.