fmap / flp.mobi

Toolchain to build ePub and Mobipocket eBooks from the online edition of The Feynman Lectures on Physics.
35 stars 41 forks source link

path normalisation #15

Closed amaksoft closed 10 years ago

amaksoft commented 10 years ago

I seem to have a problem with path normalisation in eq2img script on ubuntu 13.10. During preprocess i get a few errors like this one:

sed: -e expression #1, char 71: unknown option to 's'

And as a result ./bin/images outputs paths like this for every equation:

/home/Feynman/flp.mobi//bin/../img/00065b781ce3832d948591c35c1bc59b.png

which leads to "zip warning: name not matched" errors and missing equations in the book.

fmap commented 10 years ago

sed: -e expression #1, char 71: unknown option to 's'

I think this happens when the TeX expression includes the character closing the sed expression, passing it garbage options. Solutions:

  1. Giving sed a delimiter that we're certain doesn't appear in any equations.
  2. Using a real macro processor. m4?

And as a result ./bin/images outputs paths like this for every equation:

/home/Feynman/flp.mobi//bin/../img/00065b781ce3832d948591c35c1bc59b.png

I don't have any problems with relative paths on my system, but that's an easy fix. Give me a minute..

fmap commented 10 years ago

I don't have any problems with relative paths on my system, but that's an easy fix. Give me a minute..

Oh, no, we don't want that. Readers won't resolve absolute paths..

So I think we want a path relative to the root directory with less indirection?

(Sorry.)

fmap commented 10 years ago

I hadn't realised zip rewrote filepaths, that's really cool.