Skip to content

Commit 6d36288

Browse files
committed
Fix #3 - Render codeblocks
1 parent 47278fe commit 6d36288

File tree

6 files changed

+182
-2
lines changed

6 files changed

+182
-2
lines changed

Customization/xsl/html-processing.xsl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@
3737
<xsl:template match="para" mode="html">
3838
<p class="- topic/p ">
3939

40-
<xsl:value-of select="."/>
41-
<!--xsl:apply-templates mode="html"/-->
40+
<xsl:apply-templates mode="html"/>
4241
</p>
4342
</xsl:template>
4443

@@ -95,6 +94,15 @@
9594
</codeph>
9695
</xsl:template>
9796

97+
<!--
98+
Codeblock processing
99+
-->
100+
<xsl:template match="programlisting" mode="html">
101+
<codeblock class="+ topic/pre pr-d/codeblock ">
102+
<xsl:apply-templates mode="html"/>
103+
</codeblock>
104+
</xsl:template>
105+
98106
<!--
99107
Bold/Strong processing
100108
-->

test/codeblock/build.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<!--
3+
This file is part of the DITA-OT Doxygen Plug-in project.
4+
See the accompanying LICENSE file for applicable licenses.
5+
-->
6+
<project basedir="." default="unit-test">
7+
<import file="../bootstrap.xml"/>
8+
<description>
9+
Expect that Doxygen codeblocks are generated to DITA
10+
</description>
11+
<target name="unit-test">
12+
<property name="file" value="${basedir}/out/codeblock.xml"/>
13+
<exec-transtype transtype="dita"/>
14+
<xmltask
15+
expandEntityReferences="false"
16+
dest="${file}"
17+
outputter="simple"
18+
source="${file}"
19+
>
20+
<xmlcatalog>
21+
<dtd publicId="-//OASIS//DTD DITA Topic//EN" location="../fake.dtd"/>
22+
</xmlcatalog>
23+
</xmltask>
24+
<compare-output suffix=".xml" result="${file}"/>
25+
</target>
26+
</project>

test/codeblock/codeblock.xml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?xml version="1.0" standalone="yes"?>
2+
<doxygen version="1.9.5" xml:lang="en-US"><compounddef xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="class_i_o_driver_1_1_i_o_message_logging" kind="class" language="C++" prot="public">
3+
<compoundname>IODriver::IOMessageLogging</compoundname>
4+
<basecompoundref prot="public" virt="non-virtual">QObject</basecompoundref>
5+
<briefdescription>
6+
</briefdescription>
7+
<detaileddescription>
8+
<para>Class used to add a generic logging layer to all drivers and plugins Example: <programlisting><codeline><highlight class="normal">&lt;extensions&gt;</highlight></codeline>
9+
<codeline><highlight class="normal">&lt;/extensions&gt;</highlight></codeline>
10+
</programlisting> Additionally channelId, messageId and messageName is supported. </para>
11+
</detaileddescription>
12+
<inheritancegraph>
13+
<node id="1">
14+
<label>IODriver::IOMessageLogging</label>
15+
<link refid="class_i_o_driver_1_1_i_o_message_logging"/>
16+
<childnode refid="2" relation="public-inheritance">
17+
</childnode>
18+
</node>
19+
<node id="2">
20+
<label>QObject</label>
21+
</node>
22+
</inheritancegraph>
23+
<collaborationgraph>
24+
<node id="1">
25+
<label>IODriver::IOMessageLogging</label>
26+
<link refid="class_i_o_driver_1_1_i_o_message_logging"/>
27+
<childnode refid="2" relation="public-inheritance">
28+
</childnode>
29+
</node>
30+
<node id="2">
31+
<label>QObject</label>
32+
</node>
33+
</collaborationgraph>
34+
<location file="test.cpp" line="11" column="5" bodyfile="test.cpp" bodystart="12" bodyend="13"/>
35+
<listofallmembers>
36+
</listofallmembers>
37+
</compounddef><compounddef xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="namespace_i_o_driver" kind="namespace" language="C++">
38+
<compoundname>IODriver</compoundname>
39+
<innerclass refid="class_i_o_driver_1_1_i_o_message_logging" prot="public">IODriver::IOMessageLogging</innerclass>
40+
<briefdescription>
41+
</briefdescription>
42+
<detaileddescription>
43+
</detaileddescription>
44+
<location file="test.cpp" line="1" column="1"/>
45+
</compounddef><compounddef xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="test_8cpp" kind="file" language="C++">
46+
<compoundname>test.cpp</compoundname>
47+
<innerclass refid="class_i_o_driver_1_1_i_o_message_logging" prot="public">IODriver::IOMessageLogging</innerclass>
48+
<innernamespace refid="namespace_i_o_driver">IODriver</innernamespace>
49+
<briefdescription>
50+
</briefdescription>
51+
<detaileddescription>
52+
</detaileddescription>
53+
<programlisting>
54+
<codeline lineno="1"><highlight class="keyword">namespace<sp/></highlight><highlight class="normal">IODriver</highlight></codeline>
55+
<codeline lineno="2"><highlight class="normal">{</highlight></codeline>
56+
<codeline lineno="11" refid="class_i_o_driver_1_1_i_o_message_logging" refkind="compound"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">class<sp/></highlight><highlight class="normal"><ref refid="class_i_o_driver_1_1_i_o_message_logging" kindref="compound">IOMessageLogging</ref><sp/>:<sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/>QObject</highlight></codeline>
57+
<codeline lineno="12"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
58+
<codeline lineno="13"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
59+
<codeline lineno="14"><highlight class="normal">}</highlight></codeline>
60+
</programlisting>
61+
<location file="test.cpp"/>
62+
</compounddef></doxygen>

test/codeblock/document.ditamap

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE bookmap PUBLIC "-//OASIS//DTD DITA BookMap//EN" "bookmap.dtd">
3+
<bookmap>
4+
<appendices>
5+
<topicmeta>
6+
<navtitle>Appendices</navtitle>
7+
</topicmeta>
8+
<appendix format="dita" href="topic.dita">
9+
<topicref format="doxygen" type="topic" href="codeblock.xml"/>
10+
</appendix>
11+
</appendices>
12+
</bookmap>
13+
14+

test/codeblock/expected.xml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
3+
<?path2rootmap-uri ./?>
4+
<topic id="sample" props="doxygen" specializations="@props/deliveryTarget">
5+
<title>API Reference</title>
6+
<body>
7+
<section>
8+
<title>Namespaces</title>
9+
<ul>
10+
<li>
11+
<xref format="dita" href="#IODriver" scope="local" type="topic">IODriver</xref>
12+
</li>
13+
</ul>
14+
</section>
15+
</body>
16+
<related-links>
17+
<linkpool>
18+
<link format="dita" href="topic.dita" role="parent" scope="local" type="topic">
19+
<linktext>topic</linktext>
20+
</link>
21+
</linkpool>
22+
</related-links>
23+
<topic id="IODriver" outputclass="package" props="doxygen" specializations="@props/deliveryTarget">
24+
<title>Namespace IODriver</title>
25+
<titlealts>
26+
<navtitle>IODriver</navtitle>
27+
<searchtitle>IODriver</searchtitle>
28+
</titlealts>
29+
<body outputclass="java">
30+
<section outputclass="class_summary">
31+
<title>Class Summary</title>
32+
<ul>
33+
<li>
34+
<xref format="dita" href="#IODriver.IOMessageLogging" scope="local" type="topic">IOMessageLogging</xref>-
35+
Class used to add a generic logging layer to all drivers and plugins Example: &lt;extensions&gt;
36+
&lt;/extensions&gt;
37+
Additionally channelId, messageId and messageName is supported.</li>
38+
</ul>
39+
</section>
40+
</body>
41+
<topic id="IODriver.IOMessageLogging" outputclass="class" props="doxygen" specializations="@props/deliveryTarget">
42+
<title>Class IOMessageLogging</title>
43+
<titlealts>
44+
<navtitle>IOMessageLogging</navtitle>
45+
<searchtitle>IOMessageLogging</searchtitle>
46+
</titlealts>
47+
<body outputclass="cpp">
48+
<codeblock>public class
49+
<b>IOMessageLogging</b>extends QObject</codeblock>
50+
<p>Class used to add a generic logging layer to all drivers and plugins Example:
51+
<codeblock>&lt;extensions&gt;
52+
&lt;/extensions&gt;</codeblock>Additionally channelId, messageId and messageName is supported.</p>
53+
<section outputclass="methods_summary">
54+
<title>Method Summary</title>
55+
</section>
56+
</body>
57+
</topic>
58+
</topic>
59+
</topic>
60+

test/codeblock/topic.dita

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
3+
<topic id="topic">
4+
<title>topic</title>
5+
<body>
6+
<p>
7+
Lorem ipsum dolor sit amet consectetur adipiscing, elit porttitor taciti nostra dis potenti donec, fusce gravida primis metus.
8+
</p>
9+
</body>
10+
</topic>

0 commit comments

Comments
 (0)