diff options
-rw-r--r-- | src/epub.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/epub.rs b/src/epub.rs index b9f7e73..d09b100 100644 --- a/src/epub.rs +++ b/src/epub.rs @@ -69,11 +69,11 @@ impl Epub { if c.text.is_empty() { continue; } + let relative = path.rsplit('/').next().unwrap(); self.links - .insert(path.to_string(), (self.chapters.len(), 0)); + .insert(relative.to_string(), (self.chapters.len(), 0)); for (id, pos) in c.frag.drain(..) { - let name = path.rsplit('/').next().unwrap(); - let url = format!("{}#{}", name, id); + let url = format!("{}#{}", relative, id); self.links.insert(url, (self.chapters.len(), pos)); } self.chapters.push(c); |