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.


Leave a Reply

Your email address will not be published. Required fields are marked *