Skip to content

Commit f8433f6

Browse files
author
Hauke Wintjen
authored
Fix/link handling (#11)
* Only render global namespace if anything inside * Initial step to rework link handling. Should be unified in one template and handle different cases * Initial workaround for embedded enums * Fix warning for links of wrong type * Rendering of slots, see sections and ulinks * Fix generation of inherited methods. Dont rely on the inheritance graph, since that will output all children members into the "Inherited methods summary". Better / easier is to rely on basecompoundref. * Add signals, dont bail hard if ref not found * Dont bail on multiple base classes
1 parent c329673 commit f8433f6

File tree

6 files changed

+199
-141
lines changed

6 files changed

+199
-141
lines changed

Customization/xsl/class.xsl

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
<xsl:attribute name="id">
2323
<xsl:value-of select="dita-ot:name-to-id(compoundname)"/>
2424
</xsl:attribute>
25+
<xsl:attribute name="keys">
26+
<xsl:value-of select="concat('doxygen-',dita-ot:name-to-id(compoundname))"/>
27+
</xsl:attribute>
28+
2529
<xsl:attribute name="outputclass">
2630
<xsl:text>class</xsl:text>
2731
</xsl:attribute>
@@ -39,8 +43,8 @@
3943
<xsl:value-of select="dita-ot:prismjs(@language)"/>
4044
</xsl:attribute>
4145

42-
<xsl:if test="basecompoundref/@refid">
43-
<xsl:if test="starts-with(basecompoundref/@refid, 'interface')">
46+
<xsl:if test="basecompoundref[1]/@refid">
47+
<xsl:if test="starts-with(basecompoundref[1]/@refid, 'interface')">
4448
<p class="- topic/p ">
4549
<b class="+ topic/ph hi-d/b ">
4650
<xsl:text>All Implemented Interfaces:</xsl:text>
@@ -58,7 +62,7 @@
5862
</xsl:for-each>
5963
</ul>
6064
</xsl:if>
61-
<xsl:if test="not(starts-with(basecompoundref/@refid, 'interface'))">
65+
<xsl:if test="not(starts-with(basecompoundref[1]/@refid, 'interface'))">
6266
<p class="- topic/p ">
6367
<b class="+ topic/ph hi-d/b ">
6468
<xsl:text>Direct Base Classes:</xsl:text>
@@ -133,7 +137,7 @@
133137
<xsl:call-template name="parse-brief-description"/>
134138
<xsl:call-template name="parse-detailed-description"/>
135139

136-
<xsl:if test="sectiondef/memberdef[@kind='typedef' and @prot='public']">
140+
<xsl:if test="sectiondef/memberdef[(@kind='typedef' or @kind='enum') and @prot='public']">
137141
<!-- Class typedef Summary -->
138142
<section class="- topic/section " outputclass="typedefs_summary">
139143
<title class="- topic/title ">
@@ -166,14 +170,14 @@
166170
<xsl:text>Method Summary</xsl:text>
167171
</title>
168172
<xsl:if
169-
test="sectiondef[contains(@kind,'-func')]/memberdef[@kind='function' and not(type='') and @prot='public']"
173+
test="sectiondef/memberdef[ (@kind='function' or @kind='slot') and not(type='') and @prot='public']"
170174
>
171175
<xsl:call-template name="add-method-summary"/>
172176
</xsl:if>
173177
<xsl:call-template name="add-inherited-method-summary"/>
174178
</section>
175179

176-
<xsl:if test="sectiondef/memberdef[@kind='typedef'and @prot='public']">
180+
<xsl:if test="sectiondef/memberdef[(@kind='typedef' or @kind='enum') and @prot='public']">
177181
<!-- typedef Detail -->
178182
<section class="- topic/section " outputclass="typedefs">
179183
<xsl:attribute name="id">
@@ -183,7 +187,7 @@
183187
<xsl:text>Types Detail</xsl:text>
184188
</title>
185189
<xsl:apply-templates
186-
select="sectiondef/memberdef[@kind='typedef' and @prot='public']"
190+
select="sectiondef/memberdef[(@kind='typedef' or @kind='enum') and @prot='public']"
187191
mode="typedef"
188192
>
189193
<xsl:sort select="@id"/>
@@ -210,7 +214,7 @@
210214
</section>
211215
</xsl:if>
212216

213-
<xsl:if test="sectiondef[contains(@kind,'-func')]/memberdef[@kind='function' and type='' and @prot='public']">
217+
<xsl:if test="sectiondef/memberdef[ @kind='function' and type='' and @prot='public']">
214218
<!-- Constructor Detail -->
215219
<section class="- topic/section " outputclass="constructors">
216220
<xsl:attribute name="id">
@@ -229,7 +233,7 @@
229233
</xsl:if>
230234

231235
<xsl:if
232-
test="sectiondef[contains(@kind,'-func')]/memberdef[@kind='function' and not(type='') and @prot='public']"
236+
test="sectiondef/memberdef[(@kind='function' or @kind='slot') and not(type='') and @prot='public']"
233237
>
234238
<!-- Method Detail-->
235239
<section class="- topic/section " outputclass="methods">
@@ -240,7 +244,7 @@
240244
<xsl:text>Method Detail</xsl:text>
241245
</title>
242246
<xsl:apply-templates
243-
select="sectiondef[contains(@kind,'-func')]/memberdef[@kind='function' and not(type='') and @prot='public']"
247+
select="sectiondef/memberdef[ ( @kind='function' or @kind='slot') and not(type='') and @prot='public']"
244248
mode="method"
245249
>
246250
<xsl:sort select="name"/>
@@ -364,8 +368,9 @@
364368
<codeph class="+ topic/ph pr-d/codeph ">
365369
<xsl:attribute name="xtrc" select="concat('codeph:',generate-id(.),'3')"/>
366370
<xsl:call-template name="add-modifiers"/>
367-
<xsl:call-template name="add-class-link">
368-
<xsl:with-param name="class" select="type"/>
371+
<xsl:call-template name="add-type-link">
372+
<xsl:with-param name="refid" select="type/ref/@refid"/>
373+
<xsl:with-param name="reftext" select="type"/>
369374
</xsl:call-template>
370375
</codeph>
371376
</entry>
@@ -411,8 +416,9 @@
411416
<xsl:if test="@final='true'">
412417
<xsl:text>final </xsl:text>
413418
</xsl:if>
414-
<xsl:call-template name="add-class-link">
415-
<xsl:with-param name="class" select="type"/>
419+
<xsl:call-template name="add-type-link">
420+
<xsl:with-param name="refid" select="type/ref/@refid"/>
421+
<xsl:with-param name="reftext" select="type"/>
416422
</xsl:call-template>
417423
<xsl:value-of select="concat(' ',$field)"/>
418424
</codeph>
@@ -457,7 +463,7 @@
457463
</row>
458464
</thead>
459465
<tbody class="- topic/tbody ">
460-
<xsl:for-each select="sectiondef/memberdef[@kind='typedef' and @prot='public']">
466+
<xsl:for-each select="sectiondef/memberdef[(@kind='typedef' or @kind ='enum') and @prot='public']">
461467
<xsl:sort select="name"/>
462468
<xsl:variable name="field" select="name"/>
463469
<row class="- topic/row ">

Customization/xsl/html-processing.xsl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,35 @@
8181
-->
8282
<xsl:template match="simplesect[@kind='return']" mode="html">
8383
</xsl:template>
84+
85+
<!--
86+
simplesect kind=see
87+
-->
88+
<xsl:template match="simplesect[@kind='see']" mode="html">
89+
<xsl:text>see </xsl:text>
90+
<xsl:apply-templates mode="html"/>
91+
</xsl:template>
92+
93+
<!-- Rendering of ref (like in @see links)
94+
-->
95+
<xsl:template match="ref" mode="html">
96+
<xsl:call-template name="add-type-link">
97+
<xsl:with-param name="refid" select="@refid"/>
98+
<xsl:with-param name="reftext" select="."/>
99+
</xsl:call-template>
100+
</xsl:template>
101+
102+
<!-- Rendering of ulink (link to external urls)
103+
-->
104+
<xsl:template match="ulink" mode="html">
105+
<xref class="- topic/xref " format="html" scope="external">
106+
<xsl:attribute name="href">
107+
<xsl:value-of select="@url"/>
108+
</xsl:attribute>
109+
<xsl:processing-instruction name="ditaot">
110+
<xsl:text>usertext</xsl:text>
111+
</xsl:processing-instruction><xsl:value-of select="normalize-space(.)"/></xref>
112+
</xsl:template>
84113

85114

86115
<!--

Customization/xsl/interface.xsl

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,18 @@
4040
<codeblock class="+ topic/pre pr-d/codeblock ">
4141
<xsl:attribute name="xtrc" select="concat('codeblock:',generate-id(.),'7')"/>
4242
<xsl:value-of select="concat(@prot, ' interface ')"/>
43-
<b class="+ topic/ph hi-d/b ">
44-
<xsl:variable name="class" select="replace(compoundname, '^.*::','')"/>
45-
<xsl:call-template name="add-class-link">
46-
<xsl:with-param name="class" select="$class"/>
47-
</xsl:call-template>
43+
<b class="+ topic/ph hi-d/b ">
44+
<xsl:variable name="class" select="replace(compoundname, '^.*::','')"/>
45+
46+
<xsl:call-template name="add-type-link">
47+
<xsl:with-param name="refid" select="./ref/@refid"/>
48+
<xsl:with-param name="reftext" select="$class"/>
49+
</xsl:call-template>
4850
</b>
4951
</codeblock>
5052
<xsl:value-of select="briefdescription"/>
5153

52-
<xsl:if test="sectiondef[contains(@kind,'-func')]/memberdef[@kind='function' and not(type='')]">
54+
<xsl:if test="sectiondef[contains(@kind,'-func')]/memberdef[ (@kind='function' or @kind='slot') and not(type='')]">
5355
<!-- Interface Method Summary -->
5456
<section class="- topic/section " outputclass="methods_summary">
5557
<title class="- topic/title ">
@@ -59,7 +61,7 @@
5961
</section>
6062
</xsl:if>
6163

62-
<xsl:if test="sectiondef[contains(@kind,'-func')]/memberdef[@kind='function' and not(type='')]">
64+
<xsl:if test="sectiondef/memberdef[ (@kind='function' or @kind='slot') and not(type='')]">
6365
<!-- Interface Method Details -->
6466
<section class="- topic/section " outputclass="methods">
6567
<xsl:attribute name="id">
@@ -69,7 +71,7 @@
6971
<xsl:text>Method Detail</xsl:text>
7072
</title>
7173
<xsl:apply-templates
72-
select="sectiondef[contains(@kind,'-func')]/memberdef[@kind='function' and not(type='')]"
74+
select="sectiondef/memberdef[ (@kind='function' or @kind='slot') and not(type='')]"
7375
mode="method"
7476
>
7577
<xsl:sort select="name"/>

0 commit comments

Comments
 (0)