diff options
author | James Campos <james.r.campos@gmail.com> | 2020-09-21 05:16:15 -0700 |
---|---|---|
committer | James Campos <james.r.campos@gmail.com> | 2020-09-21 05:16:15 -0700 |
commit | eb3bd9fc920d72e129bc5137e32d9855db36031e (patch) | |
tree | e6a6b22edb96ed38df569dee1a1de680debf9a49 /src/epub.rs | |
parent | 99bf310d422993604e9afd421b05c5fdccae4d6c (diff) | |
download | bk-eb3bd9fc920d72e129bc5137e32d9855db36031e.tar.gz |
relative paths
Diffstat (limited to 'src/epub.rs')
-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); |