Closed leif81 closed 10 years ago
If we really want to match the conventions of DocBook PDF output for books, I think we should go all the way. Here are the book-related print styles I propose adding:
body.book #header { text-align: center; }
body.book #header > h1 { border: none !important; margin: 2.5em 0 1em 0; padding: 0; }
body.book #header span { line-height: 1.6; }
body.book #header br { display: block; }
body.book #header br + span { padding-left: 0; }
body.book #header br + span:before { content: none !important; }
body.book #toc { border: none !important; text-align: left !important; padding: 0 !important; }
body.book #toc, body.book #preamble, body.book h1.sect0, body.book .sect1 > h2 { page-break-before: always; }
Note that I put the page-break-before: always
on the preamble instead of the content to avoid a double page break. I also created a more conventional title page by centering the text and cleaning up the metadata hacks (dashes and commas) I have in the default stylesheet.
wdyt? If you like it, go ahead and update the pull request.
I like this a lot!
I too was getting the feeling there was some other low hanging fruit. I'm getting pretty excited by this. I'm looking at the HTML print preview of asciidoctor-writers-guide.html
in comparison to the pdf and yes there are differences, but the credibility of the printed HTML output is getting higher.
A couple other potentially low hanging fruit?:
@page { @bottom { content: "Page " counter(page) " of " counter(pages) } }
Excellent!
We were thinking alike on the page margins. In fact, I had already pushed a change upstream to make them bigger. I made them almost identical to what you proposed, but I kept the units in metric to make our European friends think more highly of us.
@page { margin: 1.25cm 0.75cm; }
The @page
declaration is not very well supported. The paged media style specification is still in flux (or just not well implemented)...hopefully when they resolve it we'll get some better ways to control page banners.
Personally, I think page numbers is something that the printer driver should be adding. It's too fragile to add via CSS atm.
I'm not sure what to do about the last updated. If you can find a way to put it somewhere nice, I'd be all for it.
Regarding the margins. I didn't see that change in master? So you want me to remove that part of my change to _print.scss
then? BTW I'm Canadian so I can handle metric, there's some things I naturally still think of in imperial though; height, weight, page margins...lol.
I got that same feeling about @page
. We'll drop that idea for now.
I think to move the last updated elsewhere (e.g. title page, or revision page) we'd have to modify more than the CSS? I suspect the asciidoctor Ruby HTML backend itself? I'm OK leaving that for a future issue so I don't hold up the 1.5.0 release with this PR.
Merged! Great work @leif81! The print styles will only get better from here :+1:
For asciidoctor/asciidoctor#952.