improve parser
All checks were successful
CI/CD Pipeline / test (push) Successful in 1m48s

This commit is contained in:
philipp 2024-02-15 15:24:39 +01:00
parent 4b00d744b6
commit 12c1348ae6

View File

@ -109,6 +109,11 @@ impl Abschnitt {
continue; continue;
} }
// Stop parsing if we reached "Anlagen" (e.g. Schifffahrtsgesetz)
if Ueberschrift::test(child, "anlage") {
return false;
}
if Ueberschrift::test(child, "titel") { if Ueberschrift::test(child, "titel") {
c.next(); c.next();
continue; continue;
@ -462,6 +467,15 @@ impl Liste {
let mut c = n.children().peekable(); let mut c = n.children().peekable();
// 162 Schifffahrtsgesetz show use that a 'schlussteil' can be at the start of a list
while let Some(child) = c.peek() {
if Schlussteil::test(child) {
content.push(Content::Text(Schlussteil::parse(c.next().unwrap()).content));
} else {
break;
}
}
content.push(Ziffernliste::parse(c.next().unwrap()).get_content()); content.push(Ziffernliste::parse(c.next().unwrap()).get_content());
while let Some(child) = c.peek() { while let Some(child) = c.peek() {