This commit is contained in:
@ -16,6 +16,7 @@
|
||||
|
||||
mod abschnitt;
|
||||
mod liste;
|
||||
mod table;
|
||||
|
||||
use abschnitt::Abschnitt;
|
||||
use roxmltree::Node;
|
||||
@ -216,41 +217,6 @@ impl Tr {
|
||||
Self { tds }
|
||||
}
|
||||
}
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub(crate) struct Table {
|
||||
trs: Vec<Tr>,
|
||||
}
|
||||
impl Table {
|
||||
pub(crate) fn test(n: &Node) -> bool {
|
||||
n.tag_name().name() == "table"
|
||||
}
|
||||
|
||||
pub(crate) fn parse(n: Node) -> Self {
|
||||
assert!(Self::test(&n));
|
||||
let mut trs = Vec::new();
|
||||
|
||||
for child in n.children() {
|
||||
trs.push(Tr::parse(&child));
|
||||
}
|
||||
|
||||
Self { trs }
|
||||
}
|
||||
|
||||
pub(crate) fn get_list(&self) -> Vec<Content> {
|
||||
let mut ret = Vec::new();
|
||||
|
||||
for tr in &self.trs {
|
||||
let mut txt = String::new();
|
||||
for td in &tr.tds {
|
||||
txt.push_str(&format!("{} ", td.absatz.content));
|
||||
}
|
||||
|
||||
ret.push(Content::Text(format!("- {txt}",)));
|
||||
}
|
||||
|
||||
ret
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub(crate) struct Schlussteil {
|
||||
|
Reference in New Issue
Block a user