add more tracing, make vbvg better structure
All checks were successful
CI/CD Pipeline / test (push) Successful in 1m49s

This commit is contained in:
2024-02-20 20:55:41 +01:00
parent 0dc59cea16
commit 39f39e49d6
5 changed files with 50 additions and 2 deletions

View File

@ -16,6 +16,7 @@
use std::iter::Peekable;
use log::trace;
use roxmltree::{Children, Node};
use crate::law::Content;
@ -39,6 +40,7 @@ impl Absatz {
// - String: (optional) paragraph id
// - Content: content of the paragraph
pub(crate) fn parse_full(c: &mut Peekable<Children>) -> (Option<String>, Content) {
trace!("Parsing absatz...");
let absatz = AbsatzAbs::parse(c.next().unwrap());
let par_id = absatz.gldsym;
@ -48,6 +50,7 @@ impl Absatz {
// If there's a "liste" after an "absatz", the "liste" should be part of the "absatz"
while let Some(child) = c.peek() {
if Liste::test(child) {
trace!("Found liste inside absatz, parsing...");
let liste = Liste::parse_full(c).content;
content.extend(liste);
} else if Table::test(child) {

View File

@ -17,7 +17,7 @@
use std::collections::HashMap;
use std::iter::Peekable;
use log::trace;
use log::{debug, trace};
use roxmltree::{Children, Node};
use crate::law::LawBuilder;
@ -73,6 +73,7 @@ impl Abschnitt {
builder.new_par(par_id, Content::List(contents));
}
debug!("Handling post metadata");
ret.handle_metadata(&mut c, builder);
// Skip all UeberschriftTitle and Absatz

View File

@ -44,12 +44,17 @@ impl Liste {
// Parse stuff inside <liste>
while let Some(child) = c.peek() {
if Ziffernliste::test(child) {
trace!("Found Ziffernliste in liste, parsing...");
let liste = Ziffernliste::parse(&mut c);
content.push(liste.get_content());
} else if Schlussteil::test(child) {
// 162 Schifffahrtsgesetz show use that a 'schlussteil' can be at the start of a list
content.push(Content::Text(Schlussteil::parse(c.next().unwrap()).content));
} else {
trace!(
"No more acceptable element in the list found: '{}'",
child.tag_name().name()
);
break;
}
}