Parsing external links as local
bedax opened this issue · 4 comments
bedax commented
I'm trying to turn the rust webassembly book into an epub. I added the necessary line to book.toml
, ran mdbook build
and got the following:
2019-08-13 12:53:33 [INFO] (mdbook::book): Book building has started
2019-08-13 12:53:33 [INFO] (mdbook::book): Running the epub backend
2019-08-13 12:53:33 [INFO] (mdbook::renderer): Invoking the "epub" renderer
Error: Inspecting the book for additional assets failed
Caused By: Unable to fetch the canonical path for /home/tom/downloads/wasmbook/src/game-of-life/https://upload.wikimedia.org/wikipedia/commons/e/e5/Gospers_glider_gun.gif
Caused By: No such file or directory (os error 2)
2019-08-13 12:53:33 [ERROR] (mdbook::renderer): Renderer exited with non-zero return code.
2019-08-13 12:53:33 [ERROR] (mdbook::utils): Error: Rendering failed
2019-08-13 12:53:33 [ERROR] (mdbook::utils): Caused By: The "epub" renderer failed
It looks like it considers that external link to be a local file
bedax commented
By the way, if you point me in the right direction, I'll be happy to give this one a go
Michael-F-Bryan commented
I have a feeling this line is to blame.
// TODO: Allow linked images to be either a URL or path on disk
// I'm assuming you'd just determine if each link is a URL or filename so
// the `find()` function can put together a deduplicated list of URLs and
// try to download all of them (in parallel?) to a temporary location. It'd
// be nice if we could have some sort of caching mechanism by using the
// destination directory (hash the URL and store it as
// `book/epub/cache/$hash.$ext`?).
bedax commented
Alright thanks, well I'll give it a go when I get a chance 👍
blandger commented
Rust Webassembly book was built using 0.4.31, works fine.
Your can take it from here
https://github.com/blandger/epub-rust-books/tree/main/Rust%20and%20WebAssembly