don't add a td if it's only used for styling
This commit is contained in:
parent
172215abaa
commit
1b49ba1314
@ -297,15 +297,19 @@ pub(crate) struct Td {
|
||||
absatz: Absatz,
|
||||
}
|
||||
impl Td {
|
||||
pub(crate) fn parse(n: &Node) -> Self {
|
||||
/// Returns `None` if td doesn't contain anything. used e.g. in § 71b to style table...
|
||||
pub(crate) fn parse(n: &Node) -> Option<Self> {
|
||||
Expect::from(n).tag("td");
|
||||
|
||||
let mut c = n.children();
|
||||
let absatz = Absatz::parse(c.next().unwrap());
|
||||
|
||||
let Some(next) = c.next() else { return None };
|
||||
|
||||
let absatz = Absatz::parse(next);
|
||||
|
||||
Expect::empty(c.next());
|
||||
|
||||
Self { absatz }
|
||||
Some(Self { absatz })
|
||||
}
|
||||
}
|
||||
|
||||
@ -320,7 +324,9 @@ impl Tr {
|
||||
let mut tds = Vec::new();
|
||||
|
||||
for child in n.children() {
|
||||
tds.push(Td::parse(&child));
|
||||
if let Some(td) = Td::parse(&child) {
|
||||
tds.push(td);
|
||||
}
|
||||
}
|
||||
|
||||
Self { tds }
|
||||
|
Loading…
Reference in New Issue
Block a user