diff options
author | James Campos <james.r.campos@gmail.com> | 2020-09-09 00:39:41 -0700 |
---|---|---|
committer | James Campos <james.r.campos@gmail.com> | 2020-09-09 00:39:41 -0700 |
commit | 99bf310d422993604e9afd421b05c5fdccae4d6c (patch) | |
tree | 9bd260bfedca6273200576dc34b17062b23f388e /src | |
parent | 7b7b6dd040dbc471c42221643c4b3339ea75910d (diff) | |
download | bk-99bf310d422993604e9afd421b05c5fdccae4d6c.tar.gz |
still need an empty check
Diffstat (limited to 'src')
-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(); |