aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Campos <james.r.campos@gmail.com>2020-09-09 00:39:41 -0700
committerJames Campos <james.r.campos@gmail.com>2020-09-09 00:39:41 -0700
commit99bf310d422993604e9afd421b05c5fdccae4d6c (patch)
tree9bd260bfedca6273200576dc34b17062b23f388e /src
parent7b7b6dd040dbc471c42221643c4b3339ea75910d (diff)
downloadbk-99bf310d422993604e9afd421b05c5fdccae4d6c.tar.gz
still need an empty check
Diffstat (limited to 'src')
-rw-r--r--src/epub.rs9
-rw-r--r--src/view.rs2
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();