Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51328 - in trunk: doc/test tools/boostbook/xsl
From: john_at_[hidden]
Date: 2009-02-19 08:33:23


Author: johnmaddock
Date: 2009-02-19 08:33:22 EST (Thu, 19 Feb 2009)
New Revision: 51328
URL: http://svn.boost.org/trac/boost/changeset/51328

Log:
Fix FO XSL customisation layer to improve formatting - use widow and orphan control rather than "keep-together", make sure formatting is applied consistently across all elements, and allow code block to line wrap with hyphenation.
Text files modified:
   trunk/doc/test/test.qbk | 2 +-
   trunk/tools/boostbook/xsl/fo.xsl | 28 +++++++++++++++++++++++++---
   2 files changed, 26 insertions(+), 4 deletions(-)

Modified: trunk/doc/test/test.qbk
==============================================================================
--- trunk/doc/test/test.qbk (original)
+++ trunk/doc/test/test.qbk 2009-02-19 08:33:22 EST (Thu, 19 Feb 2009)
@@ -57,7 +57,7 @@
 
 [endsect]
 
-[section This should cause an error in PDF builds]
+[section Code With a Very Long Line]
 
         template <class RealType> RealType inline foo(const RealType& a, const RealType& b, const RealType& c, const RealType& d, const RealType& e, const RealType& f, const RealType& g, const RealType& h){ return 0; }
 

Modified: trunk/tools/boostbook/xsl/fo.xsl
==============================================================================
--- trunk/tools/boostbook/xsl/fo.xsl (original)
+++ trunk/tools/boostbook/xsl/fo.xsl 2009-02-19 08:33:22 EST (Thu, 19 Feb 2009)
@@ -175,13 +175,16 @@
   <xsl:attribute name="padding-right">0.2cm</xsl:attribute>
   <xsl:attribute name="padding-top">0.2cm</xsl:attribute>
   <xsl:attribute name="padding-bottom">0.2cm</xsl:attribute>
- <xsl:attribute name="keep-together">1</xsl:attribute>
+ <xsl:attribute name="keep-together.within-page">1</xsl:attribute>
 </xsl:attribute-set>
 
 <!--
 Put a box around code blocks, also set the font size
 and keep the block together if we can using the widows
-and orphans controls:
+and orphans controls. Hyphenation and line wrapping
+is also turned on, so that long lines of code don't
+bleed off the edge of the page, a carriage return
+symbol is used as the hyphenation character:
 -->
 <xsl:attribute-set name="monospace.verbatim.properties">
   <xsl:attribute name="border-color">#DCDCDC</xsl:attribute>
@@ -194,8 +197,18 @@
   <xsl:attribute name="widows">6</xsl:attribute>
   <xsl:attribute name="orphans">40</xsl:attribute>
   <xsl:attribute name="font-size">9pt</xsl:attribute>
+ <xsl:attribute name="hyphenate">true</xsl:attribute>
+ <xsl:attribute name="wrap-option">wrap</xsl:attribute>
+ <xsl:attribute name="hyphenation-character">&#8629;</xsl:attribute>
 </xsl:attribute-set>
 
+<xsl:param name="hyphenate.verbatim" select="1"></xsl:param>
+
+<!--Regular monospace text should have the same font size as code blocks etc-->
+<xsl:attribute-set name="monospace.properties">
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
+</xsl:attribute-set>
+
 <!--
 Put some small amount of padding around table cells, and keep tables
 together on one page if possible:
@@ -207,8 +220,17 @@
   <xsl:attribute name="padding-bottom">0.2cm</xsl:attribute>
 </xsl:attribute-set>
 
+ <!--Formal and informal tables have the same properties
+ Using widow-and-orphan control here gives much better
+ results for very large tables than a simple "keep-together"
+ instruction-->
 <xsl:attribute-set name="table.properties">
- <xsl:attribute name="keep-together">1</xsl:attribute>
+ <xsl:attribute name="widows">6</xsl:attribute>
+ <xsl:attribute name="orphans">40</xsl:attribute>
+</xsl:attribute-set>
+<xsl:attribute-set name="informaltable.properties">
+ <xsl:attribute name="widows">6</xsl:attribute>
+ <xsl:attribute name="orphans">40</xsl:attribute>
 </xsl:attribute-set>
 
 <!--


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk