This commit is contained in:
@ -1,5 +1,6 @@
|
||||
// Copyright (C) 2024 Philipp Hofer
|
||||
//
|
||||
//
|
||||
// Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
|
||||
// the European Commission - subsequent versions of the EUPL (the "Licence").
|
||||
// You may not use this work except in compliance with the Licence.
|
||||
@ -22,6 +23,7 @@ mod table;
|
||||
use std::{fmt::Display, iter::Peekable};
|
||||
|
||||
use abschnitt::Abschnitt;
|
||||
use liste::Liste;
|
||||
use roxmltree::{Children, Node};
|
||||
|
||||
use crate::{
|
||||
@ -418,6 +420,36 @@ impl Ueberschrift {
|
||||
typ: typ.into(),
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_full_erll(n: &mut Peekable<Children>) -> Content {
|
||||
let mut ret = Vec::new();
|
||||
let mut curr = Vec::new();
|
||||
|
||||
// We need at least 1 erll
|
||||
curr.push(Content::Text(
|
||||
Self::parse(n.next().unwrap(), "erll").content,
|
||||
));
|
||||
|
||||
while let Some(child) = &mut n.peek() {
|
||||
if Absatz::test_with_typ(child, "abbobj") {
|
||||
curr.push(Absatz::parse_abbobj(n.next().unwrap()));
|
||||
} else if Liste::test(child) {
|
||||
curr.push(Content::List(Liste::parse_full(n).content));
|
||||
} else if Absatz::test_with_typ(child, "abs") {
|
||||
let (_, absatz) = Absatz::parse_full(n);
|
||||
curr.push(absatz);
|
||||
} else if Ueberschrift::test(child, "erll") {
|
||||
ret.push(Content::Multi(curr));
|
||||
curr = vec![Content::Text(
|
||||
Self::parse(n.next().unwrap(), "erll").content,
|
||||
)];
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Content::Multi(ret)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
|
Reference in New Issue
Block a user