Monthly Archives: December 2009

Fixing italics in Calibre EPUB output

I converted an ebook from TXT to EPUB today using Calibre, and found that the italics (which in the TXT file are annotated /like this/) are not converted into the HTML equivalent.  I did the following to fix this:

  1. unzip ebook.epub -d tmpbook
  2. cd tmpbook
  3. perl -i.bak -pe 's/([\s-,.;\'?:]+)\/(.+?)\/([\s-,.;\'?:]+)/$1<i>$2<\/i>$3/sg;' *html
  4. That will create.bak files just in case anything went wrong.  To revert the changes, do this:
    for i in *.bak; do mv $i ${i%.bak}; done
  5. zip -r ebook.zip * && mv ebook.zip ebook.epub

Then, I found out Calibre works beautifully with the Nook, so I just popped it on there and it worked.


Compiling ConvertLit on Ubuntu Linux 9.10

So, ConvertLit seems to be a good solution for those looking to convert LIT ebooks into EPUB (well, into HTML, but then into EPUB…).  Unfortunately, the developers seem to be unable to properly make a good source tarball for version 1.8.  Here’s what I did:

  1. Download Version 1.8 source from here.
  2. unzip clit18src.zip -d convertlit
  3. sudo apt-get install libtommath-dev
  4. Download this to the convertlit directory.
  5. patch -p1 -i clit18.source.patch
  6. You should see the clit18/Makefile was patched
  7. cd lib && make && cd ../clit18 && make
  8. the clit binary should be available in the clit18 directory
  9. sudo cp clit18/clit /usr/local/bin/
  10. Use it!

Now I just have to figure out how to convert it to epub.