diff options
-rw-r--r-- | src/epub.rs | 9 | ||||
-rw-r--r-- | src/view.rs | 2 |
2 files changed, 8 insertions, 3 deletions
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); diff --git a/src/view.rs b/src/view.rs index 41f8999..11eaccd 100644 --- a/src/view.rs +++ b/src/view.rs @@ -250,7 +250,7 @@ impl View for Page { let url = url.split('#').next().unwrap(); link = bk.links.get(url); if link.is_none() { - return + return; } } let &(chapter, byte) = link.unwrap(); |