View Single Post
Old 06-21-2011, 05:06 PM   #141
capnm
Groupie
capnm knows the difference between 'who' and 'whom'capnm knows the difference between 'who' and 'whom'capnm knows the difference between 'who' and 'whom'capnm knows the difference between 'who' and 'whom'capnm knows the difference between 'who' and 'whom'capnm knows the difference between 'who' and 'whom'capnm knows the difference between 'who' and 'whom'capnm knows the difference between 'who' and 'whom'capnm knows the difference between 'who' and 'whom'capnm knows the difference between 'who' and 'whom'capnm knows the difference between 'who' and 'whom'
 
Posts: 156
Karma: 10001
Join Date: Feb 2011
Device: sony
Let me talk my way through this ....

As it is --
The strip margins function will strip out any margins in @page or body statements in all css files.

This should be pretty darn safe. I don't think it will touch files created by any versions of Calibre to date. (They don't use body, and they don't use @page in the css).

The only potential problems I can think of occur when there are multiple @page statements, either named or in multiple stylesheets. Then, in very rare cases it could cause minor damage:
1) I've seen a couple of bespoke epubs that include an extra css specifically to facilitate conversions to pdf using Prince.
2) You might lose features such as extra whitespace at top of a title page.
3) It could mess up an epub that used body statements in the css and @page statements in the html, but nobody's doing that. Yet.

Adding margins to epubs, after successfully stripping the old ones should be pretty straightforward -- just inject an @page at the beginning of (each) css.
That should (might?) work even if there are still additional @page statements for non-margin purposes (and it's very rare that there would ever be).


Stripping margins from Calibre generated epubs is more complex, leaving much more room for error, as different versions used different techniques to define them.
Likewise adding margins to Calibre generated epubs isn't going to work well unless you've successfully stripped them.

Stripping the @page statements from the html files (required to strip margins from epubs recently created by Calibre) seems to be asking for trouble.


It would be nice to tag css files where you've stripped (and possibly added) margins so you know they're fair game for adding margins to, and that they can be ignored when looking for files to strip the margins from.

I'm already contemplating complicating Quality Check
1) Find epubs with strippable margins (other than those generated by Modify Epub)
2) Find epubs with strippable or already stripped margins (
knowing that Modify Epub could then (re)set those margins)


As an aside:
Quote:
Originally Posted by ldolse View Post
Question on capnm's '#cover @page' example.
That could well be invalid code. I found it while looking for either @page pseudo-class (@page :first {}) or @page nameid {} statements -- which I think are correct syntax, but I didn't find any examples of them in my library.

As another aside:
I'd be curious to hear what Kovid would have to say about possibly eventually switching Calibre to the @page/body in css syntax.
I suspect he has some pretty good reasons for doing it the way it is.

Last edited by capnm; 06-21-2011 at 05:08 PM.
capnm is offline   Reply With Quote