genmobi.sh - ktap

  1. #!/bin/bash

  2. name=`pwd|perl -e '$d=<>;$d=~s{.*/}{}g;$d=~s/2$//g;print $d'`
  3. src2html='src2html.pl -l -x -c -n'

  4. echo "Generating HTMLs for $name..."
  5. $src2html -t 4 --exclude='*/.*' --exclude='.*' ./ $name
  6. #exit

  7. echo "Generating .pdf file for $name..."
  8. rm -rf *.pdf
  9. ebook-convert html_out/index.html $name.pdf \
  10.     --override-profile-size \
  11.     --paper-size a4 \
  12.     --pdf-default-font-size 12 \
  13.     --pdf-mono-font-size 12 \
  14.     --margin-left 10 --margin-right 10 \
  15.     --margin-top 10 --margin-bottom 10 \
  16.     --page-breaks-before='/'
  17. #exit

  18. echo "Generating .epub file for $name..."
  19. rm -rf *.epub
  20. ebook-convert html_out/index.html $name.epub \
  21.     --no-default-epub-cover \
  22.     --publisher agentzh \
  23.     --output-profile ipad3 \
  24.     --title $name \
  25.     --language en --authors 'Jovi Zhangwei'

  26. echo "Generating .mobi file for $name..."
  27. rm -rf *.mobi
  28. ebook-convert html_out/index.html $name.mobi \
  29.     --output-profile kindle_dx --no-inline-toc \
  30.     --publisher agentzh \
  31.     --title $name \
  32.     --language en --authors 'Jovi Zhangwei'

  33. #cp -uv *.mobi ~/mobi/