From eb3bd9fc920d72e129bc5137e32d9855db36031e Mon Sep 17 00:00:00 2001 From: James Campos Date: Mon, 21 Sep 2020 05:16:15 -0700 Subject: relative paths --- src/epub.rs | 6 +++--- 1 file 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); -- cgit v1.2.3