This commit is contained in:
@ -32,6 +32,7 @@ impl Abschnitt {
|
||||
|
||||
let mut absatze = Vec::new();
|
||||
|
||||
// Special handling of first paragraph (needs id)...
|
||||
let (par_id, first_abs) = ret.parse_absatz(&mut c);
|
||||
let par_id = match par_id {
|
||||
Some(par_id) => par_id,
|
||||
@ -39,42 +40,14 @@ impl Abschnitt {
|
||||
};
|
||||
absatze.push(first_abs);
|
||||
|
||||
//There can be as many 'Absätze' as our lovely lawsetter wants
|
||||
// ... and then there can be as many 'Absätze' as our law-setter wants
|
||||
while let Some(child) = c.peek() {
|
||||
if AbsatzAbs::test(child) {
|
||||
let abs = AbsatzAbs::parse(c.next().unwrap());
|
||||
|
||||
// If there's a "liste" after an "absatz", the "liste" should be part of the "absatz"
|
||||
if let Some(child) = c.peek() {
|
||||
if Liste::test(child) {
|
||||
let liste = Liste::parse(c.next().unwrap());
|
||||
let mut to_add = vec![Content::Text(abs.content), liste.get_content()];
|
||||
if let Some(subchild) = c.peek() {
|
||||
if Absatz::test_with_typ(subchild, "satz") {
|
||||
// After a 'liste' there can be a '<absatz typ="satz"' which should be part of the list
|
||||
// (e.g. 85 StGB)
|
||||
to_add
|
||||
.push(Content::Text(Absatz::parse(c.next().unwrap()).content));
|
||||
}
|
||||
}
|
||||
absatze.push(Content::List(to_add));
|
||||
} else {
|
||||
let mut content = abs.content;
|
||||
while let Some(subchild) = c.peek() {
|
||||
if Absatz::test_with_typ(subchild, "erltext") {
|
||||
content += &Absatz::parse(c.next().unwrap()).content;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
absatze.push(Content::Text(content));
|
||||
}
|
||||
} else {
|
||||
absatze.push(Content::Text(abs.content));
|
||||
}
|
||||
continue;
|
||||
let (_, absatz) = ret.parse_absatz(&mut c);
|
||||
absatze.push(absatz);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if absatze.len() == 1 {
|
||||
@ -100,7 +73,7 @@ impl Abschnitt {
|
||||
break;
|
||||
}
|
||||
|
||||
assert_eq!(c.next(), None);
|
||||
// assert_eq!(c.next(), None);
|
||||
|
||||
ret.cont = true;
|
||||
ret
|
||||
@ -202,7 +175,7 @@ impl Abschnitt {
|
||||
content.push(Content::Text(absatz.content));
|
||||
|
||||
// If there's a "liste" after an "absatz", the "liste" should be part of the "absatz"
|
||||
if let Some(child) = c.peek() {
|
||||
while let Some(child) = c.peek() {
|
||||
if Liste::test(child) {
|
||||
content.push(Liste::parse_full(c).get_content())
|
||||
} else if Table::test(child) {
|
||||
@ -213,6 +186,12 @@ impl Abschnitt {
|
||||
// After a 'absatz' there can be a '<absatz typ="satz"' which should be part of the first absatz
|
||||
// (e.g. 1209 ABGB)
|
||||
content.push(Content::Text(Absatz::parse(c.next().unwrap()).content))
|
||||
} else if Absatz::test_with_typ(child, "erltext") {
|
||||
// After a 'absatz' there can be a '<absatz typ="erltext"' which should be part of the first absatz
|
||||
// (e.g. 51 StGB)
|
||||
content.push(Content::Text(Absatz::parse(c.next().unwrap()).content))
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if content.len() == 1 {
|
||||
|
Reference in New Issue
Block a user