Re: [Quickbook] Different rendering in Chrome [FIXED]
John Maddock <[email protected]>
| Newsgroups | gmane.comp.lib.boost.documentation |
|---|---|
| Message-ID | <6D2E8CB84B4444F2B3994F816FD3FECD@acerlaptop> |
>> > However, if we could all agree on how they should look, and the >> > conditions for breaking, then it appears this can be achieved with XSL >> > property sets, see for example: >> > http://docbook.sourceforge.net/release/xsl/current/doc/fo/section.leve >> > l1.properties.html >> >> Could it be paramaterised? (so that we wouldn't have to agree) > > And there are 6 (5 useful?) of these for different levels of sections, and > one might reasonably want > 1 and 2 to start on new page, but not minor sections 3,4,5 ... > > Note - If you use many smallish sections to improve the targeting of the > index terms (in html, an > index entry only takes you to the html page - and the page might be quite > long so you might have to > use find within the page to locate the index term), you may want not to > start each section with a > new page. > > So quite useful to parameterize? OK, patch attached. Creates a new xsl:param: "boost.section.newpage.depth" which acts much like chunk.section.depth but on PDF rather than HTML output. Defaults to 1 (put top level sections on new page only). A more detailed description is in the patch - is there anywhere to document Boost-specific xsl:param's BTW? OK to commit? I note that there are still issues with Doxygen generated reference docs. In particular "Synopsis" block titles are rendered in a much larger font that should be used - often larger than the title of the enclosing section :-( This is particularly noticeable in the PDF builds, but is true of the HTML docs as well. Seem's like the problem is that the reference docs use a mixture of section, refentry, synopsis and refsect2 blocks. Unfortunately, our ability to format these consistently is nothing like our ability to control nested sections. Would we lose anything if we replaced all these different blocks with nested sections throughout? Cheers, John. _______________________________________________ Boost-docs mailing list [email protected] http://lists.boost.org/mailman/listinfo.cgi/boost-docs
fo.patch
(application/octet-stream, 5.4 KB)
Index: fo.xsl
===================================================================
--- fo.xsl (revision 72013)
+++ fo.xsl (working copy)
@@ -18,7 +18,109 @@
<xsl:param name="make.year.ranges" select="1"/>
<xsl:param name="ulink.show" select="0"/>
- <!-- The question and answer templates are copied here from the
+
+ <!--
+ The following code sets which sections start new pages in the PDF document flow.
+
+ The parameter "boost.section.newpage.depth" set how far down the hierarchy the
+ page breaks go. Defaults to 1 (the same as html chunking), in which case only
+ top level sections start a new page, set to a higher value to force nested sections
+ onto new pages as well.
+
+ For top level sections (level 1), we use "break-before" which forces the very first
+ section onto a separate page from the TOC.
+
+ For nested sections (level 2 and greater) we use "break-after" which keeps nested
+ sections together with their enclosing section (rationale: the enclosing section
+ often has nothing but a title, and no content except the nested sections, and we
+ don't want a page break right after a section title!).
+
+ For reference sections, we turn page breaks *off* by setting "refentry.pagebreak" to 0.
+ This is for the same reason we use "break-after" for nested sections - we want reference
+ entries to be on the same page as the title and synopsis which encloses them. Ideally
+ we'd use "break-after" here too, but I can't find an easy to to fix that.
+
+ Finally note that TOC's and Indexes don't get page breaks forced after them.
+ Again there's no easy fix here, *except* for the top level TOC which gets a page break
+ after it thanks to the "break-before" on level 1 sections. Unfortunately this means
+ there's no break after the last section and before the first Index, *unless* the
+ final section has nested sections which may then trigger one!
+
+ We could fix all this by cut-and-pasting the relevant XSL from the stylesheets to here
+ and making sure everything uses "break-after", but whether it's worth it is questionable...?
+
+ -->
+
+ <xsl:param name="boost.section.newpage.depth" select="1"/>
+ <xsl:param name="refentry.pagebreak" select="0"/>
+
+ <xsl:attribute-set name="section.level1.properties" use-attribute-sets="section.properties">
+ <xsl:attribute name="break-before">
+ <xsl:if test="($boost.section.newpage.depth > 0)">
+ page
+ </xsl:if>
+ <xsl:if test="not($boost.section.newpage.depth > 0)">
+ auto
+ </xsl:if>
+ </xsl:attribute>
+ </xsl:attribute-set>
+
+ <xsl:attribute-set name="section.level2.properties" use-attribute-sets="section.properties">
+ <xsl:attribute name="break-after">
+ <xsl:if test="($boost.section.newpage.depth > 1)">
+ page
+ </xsl:if>
+ <xsl:if test="not($boost.section.newpage.depth > 1)">
+ auto
+ </xsl:if>
+ </xsl:attribute>
+ </xsl:attribute-set>
+
+ <xsl:attribute-set name="section.level3.properties" use-attribute-sets="section.properties">
+ <xsl:attribute name="break-after">
+ <xsl:if test="($boost.section.newpage.depth > 2)">
+ page
+ </xsl:if>
+ <xsl:if test="not($boost.section.newpage.depth > 2)">
+ auto
+ </xsl:if>
+ </xsl:attribute>
+ </xsl:attribute-set>
+
+ <xsl:attribute-set name="section.level4.properties" use-attribute-sets="section.properties">
+ <xsl:attribute name="break-after">
+ <xsl:if test="($boost.section.newpage.depth > 3)">
+ page
+ </xsl:if>
+ <xsl:if test="not($boost.section.newpage.depth > 3)">
+ auto
+ </xsl:if>
+ </xsl:attribute>
+ </xsl:attribute-set>
+
+ <xsl:attribute-set name="section.level5.properties" use-attribute-sets="section.properties">
+ <xsl:attribute name="break-after">
+ <xsl:if test="($boost.section.newpage.depth > 4)">
+ page
+ </xsl:if>
+ <xsl:if test="not($boost.section.newpage.depth > 4)">
+ auto
+ </xsl:if>
+ </xsl:attribute>
+ </xsl:attribute-set>
+
+ <xsl:attribute-set name="section.level6.properties" use-attribute-sets="section.properties">
+ <xsl:attribute name="break-after">
+ <xsl:if test="($boost.section.newpage.depth > 5)">
+ page
+ </xsl:if>
+ <xsl:if test="not($boost.section.newpage.depth > 5)">
+ auto
+ </xsl:if>
+ </xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- The question and answer templates are copied here from the
1.61.3 DocBook XSL stylesheets so that we can eliminate the emission
of id attributes in the emitted fo:list-item-label elements. FOP
0.20.5 has problems with these id attributes, and they are otherwise
@@ -289,17 +391,5 @@
<xsl:param name="callout.graphics.path">http://svn.boost.org/svn/boost/trunk/doc/src/images/callouts/</xsl:param>
<xsl:param name="img.src.path">http://svn.boost.org/svn/boost/trunk/doc/html/</xsl:param>
-<!-- Ideally we would use this to force top level sections
- to start on a new page, unfortunately this causes rather
- unfortunate page breaks in some Doxygen-generated
- documentation which uses <refentry> and <synopsis>
- sections :-(
-
-<xsl:attribute-set name="section.level1.properties">
- <xsl:attribute name="break-before">page</xsl:attribute>
-</xsl:attribute-set>
-
--->
-
</xsl:stylesheet>