From 12c1348ae66d9356fdbe7f7bba6d9eae6cc71238 Mon Sep 17 00:00:00 2001 From: philipp Date: Thu, 15 Feb 2024 15:24:39 +0100 Subject: [PATCH] improve parser --- src/paragraph/parser.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/paragraph/parser.rs b/src/paragraph/parser.rs index aed5196..8cc8eac 100644 --- a/src/paragraph/parser.rs +++ b/src/paragraph/parser.rs @@ -109,6 +109,11 @@ impl Abschnitt { continue; } + + // Stop parsing if we reached "Anlagen" (e.g. Schifffahrtsgesetz) + if Ueberschrift::test(child, "anlage") { + return false; + } if Ueberschrift::test(child, "titel") { c.next(); continue; @@ -462,6 +467,15 @@ impl Liste { 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()); while let Some(child) = c.peek() {