Reece Dunn wrote:As far as I can see, modifying DocBook rendering should be a matter of changing the reference.css stylesheet (see my attachment). This does a lot of the customization of the rendering because DocBook adds class elements in the same way my stylesheet does (makes it easier to change rendering).
Very slick! Just had to drop this into my html directory to see the changes.
:)
One problem (on my browser, at least, Firebird 0.7+) certain <programlisting> elements are wider than the fixed box width allocated to them. The last listing on bbv2.tutorial.properties.html demonstrates this issue.
I have fixed it so the programlisting formatting uses margin-right instead of width; does this solve the problem?
Also, although the code block looks great in normal flow, sometimes programlisting is used within a table, which doesn't look as clean. Build the Boost.Signals docs to see what I'm talking about. I'm assuming we either have to use some CSS selector to fix this, or make the xsl smarter about assigning element classes.
A CSS solution would be far to clunky considering nested divs esp. if you have para elements nested there as well. I have implemented a basic XSL:T solution that I will improve on.
I think I will also do a similar trick for the top title on a HTML page (rendering in a different colour to the other section titles) because the solution in CSS does not work for all cases.
Keep up the good work!
Will do. I am also thinking of not rendering a TOC element if there is no TOC data to display! Also, there are far too many div elements used to render title elements - I'm going to have a look at what's going on there.
I have also made a few changes to the CSS, especially when printing the HTML (select "print preview" in IE6 :D). In doing this, I have also revised the way the Boost header is rendered - what do people think?
Regards, Reece
_________________________________________________________________
Use MSN Messenger to send music and pics to your friends http://www.msn.co.uk/messenger
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" version="1.0">
<!-- Import the HTML chunking stylesheet -->
<xsl:import
href="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/>
<xsl:param name="html.stylesheet" select="'boostbook.css'"/>
<xsl:param name="navig.graphics" select="1"/>
<xsl:param name="navig.graphics.extension" select="'.png'"/>
<xsl:param name="chapter.autolabel" select="0"/>
<xsl:param name="use.id.as.filename" select="1"/>
<xsl:param name="refentry.generate.name" select="0"/>
<xsl:param name="refentry.generate.title" select="1"/>
<xsl:param name="html.extra.head.links" select="1"/>
<xsl:param name="make.year.ranges" select="1"/>
<xsl:param name="generate.manifest" select="1"/>
<xsl:param name="generate.section.toc.level" select="3"/>
<xsl:template name="header.navigation">
<table border = "1" cellpadding = "2" width = "100%" class = "boost-head">
<tr>
<td bgcolor = "#FFFFFF" width = "50%">
<img src="../../c++boost.gif"
alt="c++boost.gif (8819 bytes)" width="277" height="86"/>
</td>
<td align = "center" class = "boost-headtd">
<a href="../../index.htm" class = "boost-headelem">Home</a>
</td><td align = "center" class = "boost-headtd">
<a href="libraries.html" class = "boost-headelem">Libraries</a>
</td><td align = "center" class = "boost-headtd">
<a href="../../people/people.htm" class = "boost-headelem">People</a>
</td><td align = "center" class = "boost-headtd">
<a href="../../more/faq.htm" class = "boost-headelem">FAQ</a>
</td><td align = "center" class = "boost-headtd">
<a href="../../more/index.htm" class = "boost-headelem">More</a>
</td>
</tr>
</table>
<hr/>
</xsl:template>
<xsl:template name="format.cvs.revision">
<xsl:param name="text"/>
<!-- Remove the "$Date: " -->
<xsl:variable name="text.noprefix"
select="substring-after($text, '$Date: ')"/>
<!-- Grab the year -->
<xsl:variable name="year" select="substring-before($text.noprefix, '/')"/>
<xsl:variable name="text.noyear"
select="substring-after($text.noprefix, '/')"/>
<!-- Grab the month -->
<xsl:variable name="month" select="substring-before($text.noyear, '/')"/>
<xsl:variable name="text.nomonth"
select="substring-after($text.noyear, '/')"/>
<!-- Grab the year -->
<xsl:variable name="day" select="substring-before($text.nomonth, ' ')"/>
<xsl:variable name="text.noday"
select="substring-after($text.nomonth, ' ')"/>
<!-- Get the time -->
<xsl:variable name="time" select="substring-before($text.noday, ' ')"/>
<xsl:variable name="month.name">
<xsl:choose>
<xsl:when test="$month=1">January</xsl:when>
<xsl:when test="$month=2">February</xsl:when>
<xsl:when test="$month=3">March</xsl:when>
<xsl:when test="$month=4">April</xsl:when>
<xsl:when test="$month=5">May</xsl:when>
<xsl:when test="$month=6">June</xsl:when>
<xsl:when test="$month=7">July</xsl:when>
<xsl:when test="$month=8">August</xsl:when>
<xsl:when test="$month=9">September</xsl:when>
<xsl:when test="$month=10">October</xsl:when>
<xsl:when test="$month=11">November</xsl:when>
<xsl:when test="$month=12">December</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="concat($month.name, ' ', $day, ', ', $year, ' at ',
$time, ' GMT')"/>
</xsl:template>
<xsl:template match="copyright" mode="boost.footer">
<xsl:if test="position() > 1">
<br/>
</xsl:if>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Copyright'"/>
</xsl:call-template>
<xsl:call-template name="gentext.space"/>
<xsl:call-template name="dingbat">
<xsl:with-param name="dingbat">copyright</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="gentext.space"/>
<xsl:call-template name="copyright.years">
<xsl:with-param name="years" select="year"/>
<xsl:with-param name="print.ranges" select="$make.year.ranges"/>
<xsl:with-param name="single.year.ranges"
select="$make.single.year.ranges"/>
</xsl:call-template>
<xsl:call-template name="gentext.space"/>
<xsl:apply-templates select="holder" mode="titlepage.mode"/>
</xsl:template>
<xsl:template name="user.footer.content">
<table width="100%">
<tr>
<td align="left">
<small>
<xsl:variable name="revision-nodes"
select="ancestor-or-self::*
[not (attribute::rev:last-revision='')]"/>
<xsl:if test="count($revision-nodes)">
<xsl:variable name="revision-node"
select="$revision-nodes[last()]"/>
<p>
<xsl:text>Last revised: </xsl:text>
<xsl:call-template name="format.cvs.revision">
<xsl:with-param name="text"
select="string($revision-node/attribute::rev:last-revision)"/>
</xsl:call-template>
</p>
</xsl:if>
</small>
</td>
<td align="right">
<small>
<xsl:apply-templates select="ancestor::*/*/copyright"
mode="boost.footer"/>
</small>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="variablelist">
<xsl:choose>
<xsl:when test="@spacing='boost'">
<p><xsl:apply-templates mode="boost.variablelist"/></p>
</xsl:when>
<xsl:otherwise>
<xsl:apply-imports />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="varlistentry" mode="boost.variablelist">
<xsl:if test="position() > 1">
<br/>
</xsl:if>
<b><xsl:apply-templates select="term"/></b>:
<xsl:choose>
<xsl:when test="local-name(listitem/*[1])='simpara' or
local-name(listitem/*[1])='para'">
<xsl:apply-templates
select="listitem/*[1]/*|listitem/*[1]/text()"/>
<xsl:apply-templates select="(listitem/*|listitem/text())[position() > 1]"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="listitem/*|listitem/text()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- We don't want refentry's to show up in the TOC because they
will merely be redundant with the synopsis. -->
<xsl:template match="refentry" mode="toc"/>
<!-- override the behaviour of some DocBook elements for better
rendering facilities -->
<xsl:template match = "programlisting[ancestor::informaltable]">
<pre class = "table-{name(.)}"><xsl:apply-templates/></pre>
</xsl:template>
</xsl:stylesheet>
th
{
font-weight: bold;
text-align: center;
}
.title
{
font-weight: bold;
font-size: 2pc;
font-family: Times New Roman;
margin-bottom: 1pc;
text-align: center;
}
.toc
{
margin-left: 15%;
margin-right: 15%;
margin-bottom: 0pc;
}
div pre.programlisting, .refsynopsisdiv
{
margin-left: 3pc;
margin-right: 3pc;
}
.computeroutput, .command
{
font-family: Lucida Console;
font-size: 80%;
}
.table
{
text-align: center;
}
@media screen
{
a{ color: blue; }
th, .title
{
background-color: lightskyblue;
}
.section .title
{
background-color: #DDD;
text-align: left;
}
.table .title
{
background-color: white;
text-align: left;
}
div.table table, div.informaltable table, .section-title
{
background-color: #EEE;
}
.programlisting, .table-programlisting
{
background-color: #EED;
border: 0.2em ridge #EED;
padding: 1pc;
}
.refsynopsisdiv
{
background-color: lightskyblue;
border: 0.2em ridge cyan;
padding: 1pc;
}
.boost-head
{
background-color: #007F7F;
border: 0.1em outset #007F7F;
}
.boost-headelem
{
color: white;
font-family: Arial;
font-weight: bold;
}
table.boost-head tr td
{
border: 0.1em inset #007F7F;
}
.toc
{
border: 0.2em ridge lightcoral;
padding: 0.5pc;
background-color: #DDD;
}
}
@media print
{
body
{
text-align: justify;
}
a{ color: black; }
.boost-head, table.boost-head tr td
{
border: 0em;
}
}
