View Single Post
Old 06-20-2011, 11:30 AM   #116
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
v0.3.2 beta

Changes in this Release
  • Removing Adobe XPGT margins also removes css margins on body and page selectors

Well here goes. For now I just included this as an additional function tied to the Adobe xpgt checkbox, partially because I don't like messing with gui's so much, and partially because one checkbox to remove all the junk margins makes a bit more sense to me. Your call if you want to change it.

Note this only removes margins - replacing with a user configurable margin isn't quite so easy, so I'm just going to leave that alone for now. I've just tested on a handful of epubs, so use at your own risk.

btw, if you want to add a check for this to quality check, the regex to run against css is:
Code:
re.compile(r'(?P<element_id>#\w+\s+)?(?P<selector>\bbody|@page)\b\s*{(?P<styles>[^}]+margin[^}]+);?\s*\}', re.IGNORECASE)

Last edited by ldolse; 06-20-2011 at 10:15 PM. Reason: Updated regex, removed old version
ldolse is offline   Reply With Quote