add vereinsgesetz; add optional 'beachte' text for paragraphs
Some checks failed
CI/CD Pipeline / test (push) Has been cancelled
Some checks failed
CI/CD Pipeline / test (push) Has been cancelled
This commit is contained in:
@ -76,7 +76,24 @@ impl Abschnitt {
|
||||
Fzinhalt::parse(c.next().unwrap());
|
||||
|
||||
// Skip all UeberschriftTitle and Absatz
|
||||
while let Some(child) = c.peek() {
|
||||
while let Some(child) = &c.peek() {
|
||||
if Ueberschrift::test_with_typ_and_content(child, "titel", "Beachte") {
|
||||
c.next();
|
||||
//<absatz typ="erltext" ct="beachte" halign="j">Zu Abs. 2: zum Bezugszeitraum vgl. § 33 Abs. 13</absatz>
|
||||
|
||||
let absatz = Absatz::parse(
|
||||
c.next()
|
||||
.expect("After a 'Beachte' title, we need an Absatz"),
|
||||
);
|
||||
println!("{}", absatz.typ);
|
||||
if absatz.typ != "erltext".to_string() {
|
||||
panic!("Expected erltext absatz after 'Beachte'");
|
||||
}
|
||||
|
||||
builder.add_next_para_note(absatz.content);
|
||||
|
||||
continue;
|
||||
}
|
||||
if Ueberschrift::test(child, "titel") {
|
||||
c.next();
|
||||
continue;
|
||||
@ -508,6 +525,7 @@ impl Leaf {
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub(crate) struct Absatz {
|
||||
content: String,
|
||||
typ: String,
|
||||
}
|
||||
impl Absatz {
|
||||
pub(crate) fn test(n: &Node) -> bool {
|
||||
@ -523,10 +541,12 @@ impl Absatz {
|
||||
if let Some(text) = n.text() {
|
||||
Self {
|
||||
content: text.into(),
|
||||
typ: n.attribute("typ").unwrap().into(),
|
||||
}
|
||||
} else {
|
||||
Self {
|
||||
content: String::new(),
|
||||
typ: n.attribute("typ").unwrap().into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -541,6 +561,9 @@ impl Ueberschrift {
|
||||
fn test(n: &Node, typ: &str) -> bool {
|
||||
n.tag_name().name() == "ueberschrift" && n.attribute("typ").unwrap() == typ
|
||||
}
|
||||
fn test_with_typ_and_content(n: &Node, typ: &str, content: &str) -> bool {
|
||||
Self::test(n, typ) && n.text().unwrap() == content
|
||||
}
|
||||
|
||||
pub(crate) fn parse(n: Node, typ: &str) -> Self {
|
||||
assert!(n.tag_name().name() == "ueberschrift");
|
||||
|
Reference in New Issue
Block a user