Add support for language='c++'.

The implementation is a bit odd, but I was trying to match the existing
templates.

[SVN r86509]
This commit is contained in:
Daniel James 2013-10-28 22:35:16 +00:00
parent 5c02634c70
commit 2a7b62e58d
4 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,13 @@
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<book xmlns:xi="http://www.w3.org/2001/XInclude" id="test" lang="en">
<title>Test language attribute</title>
<programlisting>plain text</programlisting>
<programlisting><phrase role="keyword">void</phrase> <phrase role="identifier">main</phrase><phrase role="special">(</phrase><phrase role="special">)</phrase> <phrase role="special">{</phrase><phrase role="special">}</phrase></programlisting>
<programlisting><phrase role="keyword">actions</phrase> something <phrase role="special">;</phrase></programlisting>
<para>
<computeroutput>plain text</computeroutput>
<computeroutput><phrase role="keyword">void</phrase> <phrase role="identifier">main</phrase><phrase role="special">(</phrase><phrase role="special">)</phrase> <phrase role="special">{</phrase><phrase role="special">}</phrase></computeroutput>
<computeroutput><phrase role="keyword">actions</phrase> something <phrase role="special">;</phrase></computeroutput>
</para>
</book>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2013 Daniel James.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
-->
<!DOCTYPE boostbook PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
<boostbook id="test" xmlns:xi="http://www.w3.org/2001/XInclude"
last-revision="$Date: 2010-10-30 15:29:27 +0100 (Sat, 30 Oct 2010) $"
lang="en">
<title>Test language attribute</title>
<programlisting>plain text</programlisting>
<programlisting language="c++">void main() {}</programlisting>
<programlisting language="jam">actions something ;</programlisting>
<para>
<code>plain text</code>
<code language="c++">void main() {}</code>
<code language="jam">actions something ;</code>
</para>
</boostbook>

View File

@ -400,6 +400,14 @@
</computeroutput> </computeroutput>
</xsl:template> </xsl:template>
<xsl:template match="code[@language='c++']" mode="annotation">
<computeroutput>
<xsl:apply-templates mode="annotation">
<xsl:with-param name="highlight" select="true()"/>
</xsl:apply-templates>
</computeroutput>
</xsl:template>
<xsl:template match="bold" mode="annotation"> <xsl:template match="bold" mode="annotation">
<emphasis role="bold"> <emphasis role="bold">
<xsl:apply-templates mode="annotation"/> <xsl:apply-templates mode="annotation"/>

View File

@ -398,6 +398,10 @@ Error: XSL template 'link-or-anchor' called with invalid link-type '<xsl:value-o
</computeroutput> </computeroutput>
</xsl:template> </xsl:template>
<xsl:template match="code[@language='c++']">
<xsl:apply-templates select="." mode="annotation"/>
</xsl:template>
<xsl:template match="bold"> <xsl:template match="bold">
<emphasis role="bold"> <emphasis role="bold">
<xsl:apply-templates mode="annotation"/> <xsl:apply-templates mode="annotation"/>
@ -454,6 +458,10 @@ Error: XSL template 'link-or-anchor' called with invalid link-type '<xsl:value-o
</programlisting> </programlisting>
</xsl:template> </xsl:template>
<xsl:template match="programlisting[@language='c++']">
<xsl:apply-templates select="." mode="annotation"/>
</xsl:template>
<!-- These DocBook elements have special meaning. Use the annotation mode --> <!-- These DocBook elements have special meaning. Use the annotation mode -->
<xsl:template match="classname|methodname|functionname|enumname| <xsl:template match="classname|methodname|functionname|enumname|
macroname|headername|globalname"> macroname|headername|globalname">