Skip to content

Commit 9b7f11b

Browse files
committed
Remove empty namespaces from package output
1 parent 98c935e commit 9b7f11b

File tree

6 files changed

+100
-180
lines changed

6 files changed

+100
-180
lines changed

Customization/xsl/package.xsl

Lines changed: 100 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -14,108 +14,113 @@
1414
Package Summary
1515
-->
1616
<xsl:template name="add-package-summary">
17-
<li class="- topic/li ">
18-
<xsl:call-template name="add-link">
19-
<xsl:with-param name="type" select="'topic'"/>
20-
<xsl:with-param name="href" select="concat('#', dita-ot:name-to-id(compoundname))"/>
21-
<xsl:with-param name="text" select="compoundname"/>
22-
</xsl:call-template>
23-
<xsl:if test="normalize-space(briefdescription)!=''">
24-
<xsl:value-of select="concat (' - ', briefdescription)"/>
25-
</xsl:if>
26-
</li>
17+
<xsl:if test="count(../classes/compounddef) + count(../interfaces/compounddef) + count(../enums/compounddef) gt 0">
18+
<li class="- topic/li ">
19+
<xsl:call-template name="add-link">
20+
<xsl:with-param name="type" select="'topic'"/>
21+
<xsl:with-param name="href" select="concat('#', dita-ot:name-to-id(compoundname))"/>
22+
<xsl:with-param name="text" select="compoundname"/>
23+
</xsl:call-template>
24+
<xsl:if test="normalize-space(briefdescription)!=''">
25+
<xsl:value-of select="concat (' - ', briefdescription)"/>
26+
</xsl:if>
27+
</li>
28+
</xsl:if>
2729
</xsl:template>
2830
<!--
2931
Package Overview
3032
-->
3133
<xsl:template match="compounddef" mode="package">
32-
<topic
33-
domains="(topic abbrev-d) a(props deliveryTarget) (topic equation-d) (topic hazard-d) (topic hi-d) (topic indexing-d) (topic markup-d) (topic mathml-d) (topic pr-d) (topic relmgmt-d) (topic sw-d) (topic svg-d) (topic ui-d) (topic ut-d) (topic markup-d xml-d)"
34-
class="- topic/topic "
35-
props="doxygen"
36-
>
37-
<xsl:attribute name="id">
38-
<xsl:value-of select="dita-ot:name-to-id(compoundname)"/>
39-
</xsl:attribute>
40-
<xsl:attribute name="outputclass">
41-
<xsl:text>package</xsl:text>
42-
</xsl:attribute>
43-
<title class="- topic/title ">Namespace <xsl:value-of select="compoundname"/></title>
44-
<titlealts class="- topic/titlealts ">
45-
<navtitle class="- topic/navtitle ">
46-
<xsl:value-of select="compoundname"/>
47-
</navtitle>
48-
<searchtitle class="- topic/searchtitle ">
49-
<xsl:value-of select="compoundname"/>
50-
</searchtitle>
51-
</titlealts>
52-
<body class="- topic/body " outputclass="java">
53-
<xsl:call-template name="add-brief-description"/>
5434

55-
<xsl:if test="../classes/compounddef">
56-
<section class="- topic/section " outputclass="class_summary">
57-
<title class="- topic/title ">
58-
<xsl:text>Class Summary</xsl:text>
59-
</title>
60-
<ul class="- topic/ul ">
61-
<xsl:for-each select="../classes/compounddef">
62-
<xsl:sort select="name"/>
63-
<xsl:call-template name="add-items-list"/>
64-
</xsl:for-each>
65-
</ul>
66-
</section>
67-
</xsl:if>
35+
<xsl:if test="count(../classes/compounddef) + count(../interfaces/compounddef) + count(../enums/compounddef) gt 0">
36+
<topic
37+
domains="(topic abbrev-d) a(props deliveryTarget) (topic equation-d) (topic hazard-d) (topic hi-d) (topic indexing-d) (topic markup-d) (topic mathml-d) (topic pr-d) (topic relmgmt-d) (topic sw-d) (topic svg-d) (topic ui-d) (topic ut-d) (topic markup-d xml-d)"
38+
class="- topic/topic "
39+
props="doxygen"
40+
>
41+
<xsl:attribute name="id">
42+
<xsl:value-of select="dita-ot:name-to-id(compoundname)"/>
43+
</xsl:attribute>
44+
<xsl:attribute name="outputclass">
45+
<xsl:text>package</xsl:text>
46+
</xsl:attribute>
47+
<title class="- topic/title ">Namespace <xsl:value-of select="compoundname"/></title>
48+
<titlealts class="- topic/titlealts ">
49+
<navtitle class="- topic/navtitle ">
50+
<xsl:value-of select="compoundname"/>
51+
</navtitle>
52+
<searchtitle class="- topic/searchtitle ">
53+
<xsl:value-of select="compoundname"/>
54+
</searchtitle>
55+
</titlealts>
56+
<body class="- topic/body " outputclass="java">
57+
<xsl:call-template name="add-brief-description"/>
6858

69-
<!--xsl:if test="class[@exception='true']">
70-
<section class="- topic/section " outputclass="class_summary">
71-
<title class="- topic/title " >
72-
<xsl:text>Exception Summary</xsl:text>
73-
</title>
74-
<ul class="- topic/ul ">
75-
<xsl:for-each select="class[@exception='true']">
76-
<xsl:sort select="@name"/>
77-
<xsl:call-template name="add-items-list"/>
78-
</xsl:for-each>
79-
</ul>
80-
</section>
81-
</xsl:if-->
82-
<xsl:if test="../interfaces/compounddef">
83-
<section class="- topic/section " outputclass="interfaces_summary">
84-
<title class="- topic/title ">
85-
<xsl:text>Interface Summary</xsl:text>
86-
</title>
87-
<ul class="- topic/ul ">
88-
<xsl:for-each select="../interfaces/compounddef">
89-
<xsl:sort select="name"/>
90-
<xsl:call-template name="add-items-list"/>
91-
</xsl:for-each>
92-
</ul>
93-
</section>
94-
</xsl:if>
95-
<xsl:if test="../enums/compounddef">
96-
<section class="- topic/section " outputclass="enums_summary">
97-
<title class="- topic/title ">
98-
<xsl:text>Enumeration Summary</xsl:text>
99-
</title>
100-
<ul class="- topic/ul ">
101-
<xsl:for-each select="../enums/compounddef">
102-
<xsl:sort select="name"/>
103-
<xsl:call-template name="add-items-list"/>
104-
</xsl:for-each>
105-
</ul>
106-
</section>
107-
</xsl:if>
108-
</body>
109-
<xsl:apply-templates select="../classes/compounddef" mode="class">
110-
<xsl:sort select="compoundname"/>
111-
</xsl:apply-templates>
112-
<xsl:apply-templates select="../interfaces/compounddef" mode="interface">
113-
<xsl:sort select="compoundname"/>
114-
</xsl:apply-templates>
115-
<xsl:apply-templates select="../enums/compounddef" mode="enum">
116-
<xsl:sort select="compoundname"/>
117-
</xsl:apply-templates>
118-
</topic>
59+
<xsl:if test="../classes/compounddef">
60+
<section class="- topic/section " outputclass="class_summary">
61+
<title class="- topic/title ">
62+
<xsl:text>Class Summary</xsl:text>
63+
</title>
64+
<ul class="- topic/ul ">
65+
<xsl:for-each select="../classes/compounddef">
66+
<xsl:sort select="name"/>
67+
<xsl:call-template name="add-items-list"/>
68+
</xsl:for-each>
69+
</ul>
70+
</section>
71+
</xsl:if>
72+
73+
<!--xsl:if test="class[@exception='true']">
74+
<section class="- topic/section " outputclass="class_summary">
75+
<title class="- topic/title " >
76+
<xsl:text>Exception Summary</xsl:text>
77+
</title>
78+
<ul class="- topic/ul ">
79+
<xsl:for-each select="class[@exception='true']">
80+
<xsl:sort select="@name"/>
81+
<xsl:call-template name="add-items-list"/>
82+
</xsl:for-each>
83+
</ul>
84+
</section>
85+
</xsl:if-->
86+
<xsl:if test="../interfaces/compounddef">
87+
<section class="- topic/section " outputclass="interfaces_summary">
88+
<title class="- topic/title ">
89+
<xsl:text>Interface Summary</xsl:text>
90+
</title>
91+
<ul class="- topic/ul ">
92+
<xsl:for-each select="../interfaces/compounddef">
93+
<xsl:sort select="name"/>
94+
<xsl:call-template name="add-items-list"/>
95+
</xsl:for-each>
96+
</ul>
97+
</section>
98+
</xsl:if>
99+
<xsl:if test="../enums/compounddef">
100+
<section class="- topic/section " outputclass="enums_summary">
101+
<title class="- topic/title ">
102+
<xsl:text>Enumeration Summary</xsl:text>
103+
</title>
104+
<ul class="- topic/ul ">
105+
<xsl:for-each select="../enums/compounddef">
106+
<xsl:sort select="name"/>
107+
<xsl:call-template name="add-items-list"/>
108+
</xsl:for-each>
109+
</ul>
110+
</section>
111+
</xsl:if>
112+
</body>
113+
<xsl:apply-templates select="../classes/compounddef" mode="class">
114+
<xsl:sort select="compoundname"/>
115+
</xsl:apply-templates>
116+
<xsl:apply-templates select="../interfaces/compounddef" mode="interface">
117+
<xsl:sort select="compoundname"/>
118+
</xsl:apply-templates>
119+
<xsl:apply-templates select="../enums/compounddef" mode="enum">
120+
<xsl:sort select="compoundname"/>
121+
</xsl:apply-templates>
122+
</topic>
123+
</xsl:if>
119124
</xsl:template>
120125
<!--
121126
Summary listing for Classes, Interfaces and Enumeration

test/codeblock/expected.xml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
<section>
88
<title>Namespaces</title>
99
<ul>
10-
<li>
11-
<xref format="dita" href="#Global" scope="local" type="topic">Global</xref>
12-
</li>
1310
<li>
1411
<xref format="dita" href="#IODriver" scope="local" type="topic">IODriver</xref>
1512
</li>
@@ -23,14 +20,6 @@
2320
</link>
2421
</linkpool>
2522
</related-links>
26-
<topic id="Global" outputclass="package" props="doxygen" specializations="@props/deliveryTarget">
27-
<title>Namespace Global</title>
28-
<titlealts>
29-
<navtitle>Global</navtitle>
30-
<searchtitle>Global</searchtitle>
31-
</titlealts>
32-
<body outputclass="java"></body>
33-
</topic>
3423
<topic id="IODriver" outputclass="package" props="doxygen" specializations="@props/deliveryTarget">
3524
<title>Namespace IODriver</title>
3625
<titlealts>

test/cppdoc/expected.xml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
<section>
88
<title>Namespaces</title>
99
<ul>
10-
<li>
11-
<xref format="dita" href="#Global" scope="local" type="topic">Global</xref>
12-
</li>
1310
<li>
1411
<xref format="dita" href="#transport" scope="local" type="topic">transport</xref>
1512
</li>
@@ -23,14 +20,6 @@
2320
</link>
2421
</linkpool>
2522
</related-links>
26-
<topic id="Global" outputclass="package" props="doxygen" specializations="@props/deliveryTarget">
27-
<title>Namespace Global</title>
28-
<titlealts>
29-
<navtitle>Global</navtitle>
30-
<searchtitle>Global</searchtitle>
31-
</titlealts>
32-
<body outputclass="java"></body>
33-
</topic>
3423
<topic id="transport" outputclass="package" props="doxygen" specializations="@props/deliveryTarget">
3524
<title>Namespace transport</title>
3625
<titlealts>

test/javadoc/expected.xml

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,6 @@
77
<section>
88
<title>Namespaces</title>
99
<ul>
10-
<li>
11-
<xref format="dita" href="#Global" scope="local" type="topic">Global</xref>
12-
</li>
13-
<li>
14-
<xref format="dita" href="#org" scope="local" type="topic">org</xref>
15-
</li>
16-
<li>
17-
<xref format="dita" href="#org.casbin" scope="local" type="topic">org::casbin</xref>
18-
</li>
19-
<li>
20-
<xref format="dita" href="#org.casbin.jcasbin" scope="local" type="topic">org::casbin::jcasbin</xref>
21-
</li>
2210
<li>
2311
<xref format="dita" href="#org.casbin.jcasbin.config" scope="local" type="topic">org::casbin::jcasbin::config</xref>
2412
</li>
@@ -59,38 +47,6 @@
5947
</link>
6048
</linkpool>
6149
</related-links>
62-
<topic id="Global" outputclass="package" props="doxygen" specializations="@props/deliveryTarget">
63-
<title>Namespace Global</title>
64-
<titlealts>
65-
<navtitle>Global</navtitle>
66-
<searchtitle>Global</searchtitle>
67-
</titlealts>
68-
<body outputclass="java"></body>
69-
</topic>
70-
<topic id="org" outputclass="package" props="doxygen" specializations="@props/deliveryTarget">
71-
<title>Namespace org</title>
72-
<titlealts>
73-
<navtitle>org</navtitle>
74-
<searchtitle>org</searchtitle>
75-
</titlealts>
76-
<body outputclass="java"></body>
77-
</topic>
78-
<topic id="org.casbin" outputclass="package" props="doxygen" specializations="@props/deliveryTarget">
79-
<title>Namespace org::casbin</title>
80-
<titlealts>
81-
<navtitle>org::casbin</navtitle>
82-
<searchtitle>org::casbin</searchtitle>
83-
</titlealts>
84-
<body outputclass="java"></body>
85-
</topic>
86-
<topic id="org.casbin.jcasbin" outputclass="package" props="doxygen" specializations="@props/deliveryTarget">
87-
<title>Namespace org::casbin::jcasbin</title>
88-
<titlealts>
89-
<navtitle>org::casbin::jcasbin</navtitle>
90-
<searchtitle>org::casbin::jcasbin</searchtitle>
91-
</titlealts>
92-
<body outputclass="java"></body>
93-
</topic>
9450
<topic id="org.casbin.jcasbin.config" outputclass="package" props="doxygen" specializations="@props/deliveryTarget">
9551
<title>Namespace org::casbin::jcasbin::config</title>
9652
<titlealts>

test/multiple-base/expected.xml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
<section>
88
<title>Namespaces</title>
99
<ul>
10-
<li>
11-
<xref format="dita" href="#Global" scope="local" type="topic">Global</xref>
12-
</li>
1310
<li>
1411
<xref format="dita" href="#Types" scope="local" type="topic">Types</xref>
1512
</li>
@@ -23,14 +20,6 @@
2320
</link>
2421
</linkpool>
2522
</related-links>
26-
<topic id="Global" outputclass="package" props="doxygen" specializations="@props/deliveryTarget">
27-
<title>Namespace Global</title>
28-
<titlealts>
29-
<navtitle>Global</navtitle>
30-
<searchtitle>Global</searchtitle>
31-
</titlealts>
32-
<body outputclass="java"></body>
33-
</topic>
3423
<topic id="Types" outputclass="package" props="doxygen" specializations="@props/deliveryTarget">
3524
<title>Namespace Types</title>
3625
<titlealts>

test/templated-base/expected.xml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@
2323
</link>
2424
</linkpool>
2525
</related-links>
26-
<topic id="Global" outputclass="package" props="doxygen" specializations="@props/deliveryTarget">
27-
<title>Namespace Global</title>
28-
<titlealts>
29-
<navtitle>Global</navtitle>
30-
<searchtitle>Global</searchtitle>
31-
</titlealts>
32-
<body outputclass="java"></body>
33-
</topic>
3426
<topic id="Types" outputclass="package" props="doxygen" specializations="@props/deliveryTarget">
3527
<title>Namespace Types</title>
3628
<titlealts>

0 commit comments

Comments
 (0)