aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/epub.rs5
-rw-r--r--src/view.rs2
2 files changed, 6 insertions, 1 deletions
diff --git a/src/epub.rs b/src/epub.rs
index 7f203d0..4beff00 100644
--- a/src/epub.rs
+++ b/src/epub.rs
@@ -76,6 +76,11 @@ impl Epub {
let url = format!("{}#{}", relative, id);
self.links.insert(url, (self.chapters.len(), pos));
}
+ for link in c.links.iter_mut() {
+ if link.2.starts_with('#') {
+ link.2.insert_str(0, relative);
+ }
+ }
self.chapters.push(c);
}
}
diff --git a/src/view.rs b/src/view.rs
index 7593eea..2f0ecfc 100644
--- a/src/view.rs
+++ b/src/view.rs
@@ -244,7 +244,7 @@ impl View for Page {
if let Ok(i) = r {
let url = &c.links[i].2;
- let &(chapter, byte) = bk.links.get(url).expect(url);
+ let &(chapter, byte) = bk.links.get(url).unwrap();
let line = get_line(&bk.chapters[chapter].lines, byte);
bk.jump((chapter, line));
}