From: Jirka K. <ko...@us...> - 2006-05-16 20:24:02
|
Update of /cvsroot/docbook/docbook/relaxng/docbook/howto/stylesheets In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv4645/relaxng/docbook/howto/stylesheets Modified Files: fo.xsl html.xsl Log Message: Improved display of programlistings (language attribute is shown as a label) Index: fo.xsl =================================================================== RCS file: /cvsroot/docbook/docbook/relaxng/docbook/howto/stylesheets/fo.xsl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -U2 -r1.5 -r1.6 --- fo.xsl 28 Dec 2005 13:13:03 -0000 1.5 +++ fo.xsl 16 May 2006 20:23:58 -0000 1.6 @@ -4,5 +4,7 @@ version="1.0"> -<xsl:import href="../../../../../xsl/fo/docbook.xsl"/> +<xsl:import href="../../../../../xsl/fo/profile-docbook.xsl"/> + +<xsl:param name="profile.status">final</xsl:param> <xsl:param name="body.start.indent" select="'0pt'"/> @@ -129,3 +131,21 @@ <xsl:param name="ulink.footnotes" select="1"/> +<xsl:template match="programlisting[@language]"> + <fo:block clear="left"/> + <fo:float float="start"> + <fo:block width="0.4cm" text-align="end" font-family="Helvetica" font-size="7pt" font-weight="bold" + margin-left="-0.4cm"> + <xsl:if test="not(preceding-sibling::*[1]/self::programlisting)"> + <xsl:attribute name="margin-top">1.5em</xsl:attribute> + </xsl:if> + <fo:block-container reference-orientation="90" width="0.8cm"> + <fo:block color="white" background-color="#808080" text-align="center"> + <xsl:value-of select="translate(@language,'rngc','RNGC')"/> + </fo:block> + </fo:block-container> + </fo:block> + </fo:float> + <xsl:apply-imports/> +</xsl:template> + </xsl:stylesheet> Index: html.xsl =================================================================== RCS file: /cvsroot/docbook/docbook/relaxng/docbook/howto/stylesheets/html.xsl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -U2 -r1.5 -r1.6 --- html.xsl 28 Feb 2006 21:33:40 -0000 1.5 +++ html.xsl 16 May 2006 20:23:58 -0000 1.6 @@ -3,5 +3,7 @@ version="1.0"> -<xsl:import href="../../../../../xsl/html/docbook.xsl"/> +<xsl:import href="../../../../../xsl/html/profile-docbook.xsl"/> + +<xsl:param name="profile.status">final</xsl:param> <xsl:template name="user.head.content"> @@ -158,3 +160,73 @@ </xsl:template> +<!-- Support for labels identifying programlisting syntax used --> +<xsl:template match="programlisting[@language]"> + <xsl:param name="suppress-numbers" select="'0'"/> + <xsl:variable name="id"> + <xsl:call-template name="object.id"/> + </xsl:variable> + + <xsl:call-template name="anchor"/> + + <xsl:if test="$shade.verbatim != 0"> + <xsl:message> + <xsl:text>The shade.verbatim parameter is deprecated. </xsl:text> + <xsl:text>Use CSS instead,</xsl:text> + </xsl:message> + <xsl:message> + <xsl:text>for example: pre.</xsl:text> + <xsl:value-of select="local-name(.)"/> + <xsl:text> { background-color: #E0E0E0; }</xsl:text> + </xsl:message> + </xsl:if> + + <xsl:choose> + <xsl:when test="$suppress-numbers = '0' + and @linenumbering = 'numbered' + and $use.extensions != '0' + and $linenumbering.extension != '0'"> + <xsl:variable name="rtf"> + <xsl:apply-templates/> + </xsl:variable> + <pre class="{name(.)}"> + <xsl:call-template name="role.label"/> + <xsl:call-template name="number.rtf.lines"> + <xsl:with-param name="rtf" select="$rtf"/> + </xsl:call-template> + </pre> + </xsl:when> + <xsl:otherwise> + <pre class="{name(.)}"> + <xsl:call-template name="role.label"/> + <xsl:apply-templates/> + </pre> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template name="role.label"> + <span class="rolelabel"> + <xsl:call-template name="brealize"> + <xsl:with-param name="text" select="@language"/> + </xsl:call-template> + </span> +</xsl:template> + +<xsl:template name="brealize"> + <xsl:param name="text"/> + <xsl:variable name="head" select="substring($text, 1, 1)"/> + <xsl:variable name="tail" select="substring($text, 2)"/> + + <xsl:if test="$head != ''"> + <xsl:value-of select="$head"/> + </xsl:if> + + <xsl:if test="$tail != ''"> + <br/> + <xsl:call-template name="brealize"> + <xsl:with-param name="text" select="$tail"/> + </xsl:call-template> + </xsl:if> +</xsl:template> + </xsl:stylesheet> |