View Single Post
Old 06-19-2011, 02:51 PM   #113
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: 150
Karma: 10001
Join Date: Feb 2011
Device: sony
Unfortunately Python is way outside my comfort zone.

Quote:
Originally Posted by kiwidude View Post
I think allowing a user to set values would make things even more complicated as then you have the whole units thing - em, in, pt, px, % etc.
You could be restrictive and ask for four values and force the units to be pt.
Or you could just ask for a string and offer "margin-left: 5pt; margin-right: 5pt; margin-top: 10pt; margin-bottom: 10pt;" as an example. That way if the user provides an invalid string it's their fault , but it's also empowers those with a little knowledge (or daring).


Quote:
So what is the difference between @page and body anyway? How do they relate?
@page controls the size of the page and size and location of a 'box' on the page (via margins) and isn't really aware of the text, font, etc (although I think it can control widows/orphans).

body defines the text block, the "default" font, fontsize, spacing, etc and can have margins for the text inside the page box.

Actually I'm a little confused by Idolse's example, because I don't think you can use em units (which are font size dependent) at the @page level, only fixed units or %. But maybe that's just more poor coding by commercial publishers


I *think*, as Idolse said, search the css for @page or body then grab the text between the {} following, then strip out anything that begins "margin" and ends with a ";" should complete margin removal.

Then to add the desired margins you could just add them to the first @page or body you found. Or a little cleaner would be to add a new @page. Cleaner still would be to then completely delete existing any @page that is now empty.

And I wouldn't try too hard for perfection on this -- if it doesn't produce the desired result that just means the user has to hand edit that book if they really care.

And hopefully my blather will help whoever can be talked into coding this
capnm is offline   Reply With Quote