View Single Post
Old 06-12-2014, 07:34 PM   #38
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,701
Karma: 205039118
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
So this is what I have.
This is not a stand-alone python script.
You must have calibre installed.

You launch the script like so:
Code:
calibre-debug cm2em_calibre.py file.epub
Should catch rules that have dimension-type properties in cm and convert them to em (whether they're in short-hand notation or not).
It's not going to work with any rules inside of @media queries if your css gets that complicated, but it should catch everything else.

I included a sample batch file and a bash script if anyone is interested in launching this in a more permanent way.

REMEMBER! THIS SCRIPT WILL MODIFY THE EPUB YOU STARTED WITH ... MAKE SURE YOU HAVE BACKUPS BEFORE USING.
Attached Files
File Type: zip cm2em.zip (1.4 KB, 274 views)

Last edited by DiapDealer; 06-13-2014 at 12:55 PM.
DiapDealer is online now   Reply With Quote