From 99bf310d422993604e9afd421b05c5fdccae4d6c Mon Sep 17 00:00:00 2001 From: James Campos Date: Wed, 9 Sep 2020 00:39:41 -0700 Subject: still need an empty check --- src/epub.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/epub.rs') diff --git a/src/epub.rs b/src/epub.rs index ab727b0..b9f7e73 100644 --- a/src/epub.rs +++ b/src/epub.rs @@ -66,7 +66,11 @@ impl Epub { frag: Vec::new(), }; render(body, &mut c); - self.links.insert(path.to_string(), (self.chapters.len(), 0)); + if c.text.is_empty() { + continue; + } + self.links + .insert(path.to_string(), (self.chapters.len(), 0)); for (id, pos) in c.frag.drain(..) { let name = path.rsplit('/').next().unwrap(); let url = format!("{}#{}", name, id); @@ -91,7 +95,8 @@ impl Epub { self.rootdir = match path.rfind('/') { Some(n) => &path[..=n], None => "", - }.to_string(); + } + .to_string(); let mut manifest = HashMap::new(); let mut nav = HashMap::new(); let mut children = doc.root_element().children().filter(Node::is_element); -- cgit v1.2.3