mirror of
https://github.com/boostorg/boostbook.git
synced 2025-05-09 02:43:58 +00:00
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:
parent
5c02634c70
commit
2a7b62e58d
13
test/more/tests/syntax-highlight/language-attribute.gold
Normal file
13
test/more/tests/syntax-highlight/language-attribute.gold
Normal 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>
|
25
test/more/tests/syntax-highlight/language-attribute.xml
Normal file
25
test/more/tests/syntax-highlight/language-attribute.xml
Normal 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>
|
||||
|
@ -400,6 +400,14 @@
|
||||
</computeroutput>
|
||||
</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">
|
||||
<emphasis role="bold">
|
||||
<xsl:apply-templates mode="annotation"/>
|
||||
|
@ -398,6 +398,10 @@ Error: XSL template 'link-or-anchor' called with invalid link-type '<xsl:value-o
|
||||
</computeroutput>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="code[@language='c++']">
|
||||
<xsl:apply-templates select="." mode="annotation"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="bold">
|
||||
<emphasis role="bold">
|
||||
<xsl:apply-templates mode="annotation"/>
|
||||
@ -454,6 +458,10 @@ Error: XSL template 'link-or-anchor' called with invalid link-type '<xsl:value-o
|
||||
</programlisting>
|
||||
</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 -->
|
||||
<xsl:template match="classname|methodname|functionname|enumname|
|
||||
macroname|headername|globalname">
|
||||
|
Loading…
x
Reference in New Issue
Block a user