Skip to content

Instantly share code, notes, and snippets.

@mhulse
Created August 5, 2016 04:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mhulse/4f3fe401c76c2ec2a79382279c7c42bd to your computer and use it in GitHub Desktop.
Save mhulse/4f3fe401c76c2ec2a79382279c7c42bd to your computer and use it in GitHub Desktop.
Bash script to convert .epub (x)HTML into .icml files; used to get ebooks into Indesign. http://indesignsecrets.com/ebook-production-backwards-from-epub-to-indesign.php
#!/usr/bin/env bash
function init() {
dlxsl && transform
}
function dlxsl() {
curl -O -J "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/ickmull/tkbr2icml-v044.xsl" --silent
}
function transform() {
for filename in *.html; do
for ((i=0; i<=3; i++)); do
base=${filename%.html}
xsltproc --output "$base.icml" --novalid "tkbr2icml-v044.xsl" $filename
done
done
}
# Start program:
init
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment