View Single Post
Old 06-11-2011, 03:09 AM   #97
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
My 2 cents on the css removal features - I think there are a couple things that could be both feasible and recommended. This plugin has led me to a crusade to remove all the garbage margins from my epubs, and I'm learned that in some cases margins I've been blaming on adobe xpgt are actually css margins. In the examples I've looked at these are easy to remove programmatically - basically just parse the css and look for any margins on body or @page, and delete/zero these. Margins on any other element could potentially be specific, but margins on body and @page are safe to delete wholesale.

To keep the UI simple perhaps the Modify Epub plugin should just have a checkbox to 'remove book level' margins or something along those lines and then delete both css and Adobe types of margins.

A preference to add back an @page css margin of the user's specification could also be useful, as it seems like the best practice from the epub sub-forums (and Calibre's default) is to use @page to specify margins across the book.


On the Adobe xpgt front, I've found a couple useful things. Number one is a mimetype is missing - I had to add a third mimetype to the function to successfully modify the margins on some files:
Code:
            if (mt.lower() in ('application/vnd.adobe-page-template+xml',
                    'application/adobe-page-template+xml', 'application/vnd.adobe.page-template+xml') and
                    hasattr(data, 'xpath')):
Oddly enough Quality Check did find xpgt files with that mimetype....

Second, I've discovered another anomaly between the way Quality Check and Modify Epub work. Quality check is discovering xpgt files which have margins, but then Modify Epub was unable to remove them. Further investigation showed that the reason was the xpgt files weren't in the OPF manifest. Now it turns out that Adobe DE ignores unmanifested xpgt files, so that leaves some options on how to handle them. I'd like to fix things so that these books don't show up in future Quality Check searches, so that leaves two options - either Quality Check recognizes that unmanifested xpgt files don't return 'True' for the xpgt margins check, or the Modify ePub plugin deletes the offending xpgt files completely.
ldolse is offline   Reply With Quote