The first run of the script didn't work well on my Mac. To be honest it failed because of the missing dependencies (markdown and the path to calibre). I didn't want to download markdown and install it for this one time use. I decided to have a look into the script and find a different solution.
The creation of the epub is basically running in three steps:
- Convert all Files from the given language directory and fix the links to the figures. Convert the files afterwards into HTML by using markdown. Write the file to the target directory
- Merge all files from the target directory into one big HTML file
- Call calibre's
ebook-convertand create the epub out of it
- Use of markdownj instead the perl markdown implementation. I'm using groovy's
@Grabannotation here to download the library on the first run of the script.
- Make use of groovy's great Regex support and do a one-line search and replace on the whole file content
- Added a custom CSS for the epub, to improve the layout of lists in the epub
- Reduced the overall LOC by removing unnecessary code