improvement
All checks were successful
CI/CD Pipeline / test (push) Successful in 1m57s

This commit is contained in:
2024-02-17 20:15:38 +01:00
parent 6731f4f0d0
commit f517459819
12 changed files with 122 additions and 129 deletions

View File

@ -48,7 +48,8 @@ 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) {
content.push(Liste::parse_full(c).get_content())
let liste = Liste::parse_full(c).content;
content.extend(liste);
} else if Table::test(child) {
// If there's a "table" after an "absatz", the "table" should be part of the "absatz"
let table = Table::parse_full(c);

View File

@ -25,7 +25,7 @@ use crate::{
#[derive(Debug)]
pub(crate) struct Liste {
content: Vec<Content>,
pub(crate) content: Vec<Content>,
}
impl Liste {
pub(crate) fn test(n: &Node) -> bool {
@ -61,12 +61,4 @@ impl Liste {
}
Self { content }
}
pub(crate) fn get_content(&self) -> Content {
if self.content.len() == 1 {
self.content[0].clone()
} else {
Content::List(self.content.clone())
}
}
}