Skip to content

Commit c1a4a28

Browse files
author
Hauke Wintjen
authored
Fix/formatting (#8)
* Only include the brief in the class summary * Add brief in front of class details * Fix white space handling in code blocks * (Partially) fix member type refs. Still unresolved but with good name * Fix bullet list in description. Ignore duplicated parameter list * Include brief in front of detailed description * Add typedef summary * Use var to precalc link text * Quote lt / gt in href links * Only add inherited name if there is a name * Add typedef details * Fix link to type details * Fix rendering of base classes. Dont get name from ref, since that may not be there. * Fix typo in xsl * Fix linking of derived / base component refs * Add rendering of base classes * Also render namespaces with only namespaces inside * Add rendering of content in global namespace
1 parent 973cc71 commit c1a4a28

File tree

7 files changed

+257
-33
lines changed

7 files changed

+257
-33
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: CI
33
push:
44
branches:
55
- master
6+
- 'fix/*'
67
pull_request:
78
branches:
89
- master
@@ -24,6 +25,7 @@ jobs:
2425
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2526
# SONAR_CLOUD_LOGIN: ${{ secrets.SONAR_CLOUD_LOGIN }}
2627

28+
2729
unit-test:
2830
name: Unit Tests
2931
runs-on: ubuntu-latest

Customization/xsl/class.xsl

Lines changed: 160 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,29 @@
4747
</b>
4848
</p>
4949
<ul class="- topic/ul ">
50-
<xsl:for-each select="basecompoundref">
50+
<xsl:for-each select="basecompoundref[starts-with(@refid, 'interface')]">
51+
<li class="- topic/li ">
52+
<xsl:call-template name="add-link">
53+
<xsl:with-param name="type" select="'topic'"/>
54+
<xsl:with-param name="href" select="concat('#', dita-ot:name-to-id(.))"/>
55+
<xsl:with-param name="text" select="."/>
56+
</xsl:call-template>
57+
</li>
58+
</xsl:for-each>
59+
</ul>
60+
</xsl:if>
61+
<xsl:if test="not(starts-with(basecompoundref/@refid, 'interface'))">
62+
<p class="- topic/p ">
63+
<b class="+ topic/ph hi-d/b ">
64+
<xsl:text>Direct Base Classes:</xsl:text>
65+
</b>
66+
</p>
67+
<ul class="- topic/ul ">
68+
<xsl:for-each select="basecompoundref[not(starts-with(@refid, 'interface'))]">
5169
<li class="- topic/li ">
5270
<xsl:call-template name="add-link">
5371
<xsl:with-param name="type" select="'topic'"/>
54-
<xsl:with-param name="href" select="concat('#', .)"/>
72+
<xsl:with-param name="href" select="concat('#', dita-ot:name-to-id(.))"/>
5573
<xsl:with-param name="text" select="."/>
5674
</xsl:call-template>
5775
</li>
@@ -70,7 +88,7 @@
7088
<li class="- topic/li ">
7189
<xsl:call-template name="add-link">
7290
<xsl:with-param name="type" select="'topic'"/>
73-
<xsl:with-param name="href" select="concat('#', encode-for-uri(.))"/>
91+
<xsl:with-param name="href" select="concat('#', dita-ot:name-to-id(.))"/>
7492
<xsl:with-param name="text" select="."/>
7593
</xsl:call-template>
7694
</li>
@@ -83,35 +101,47 @@
83101
<xsl:value-of select="concat(@prot, ' class ')"/>
84102
<b class="+ topic/ph hi-d/b "><xsl:value-of select="replace(compoundname,'^.*::','')"/></b>
85103
<xsl:choose>
86-
<xsl:when test="basecompoundref/@refid">
104+
<xsl:when test="basecompoundref">
87105
<xsl:text> extends </xsl:text>
88106

89107
<xsl:for-each select="basecompoundref">
90108
<xsl:variable name="extends" select="@refid"/>
91-
<xsl:variable name="extends-name" select="//compounddef[@id=$extends]/compoundname"/>
92-
<xsl:if test="$extends-name">
93-
94-
<xsl:call-template name="add-link">
95-
<xsl:with-param name="type" select="'topic'"/>
96-
<xsl:with-param
97-
name="href"
98-
select="concat('#', dita-ot:name-to-id($extends-name))"
99-
/>
100-
<xsl:with-param name="text" select="replace(.,'^.*\.','')"/>
101-
</xsl:call-template>
102-
</xsl:if>
109+
<xsl:variable name="extends-name" select="text()"/>
110+
<xsl:choose>
111+
<xsl:when test="$extends-name">
112+
<xsl:call-template name="add-link">
113+
<xsl:with-param name="type" select="'topic'"/>
114+
<xsl:with-param
115+
name="href"
116+
select="concat('#', dita-ot:name-to-id($extends-name))"
117+
/>
118+
<xsl:with-param name="text" select="replace(.,'^.*\.','')"/>
119+
</xsl:call-template>
120+
</xsl:when>
121+
<xsl:otherwise>
122+
<xsl:value-of select="."/>
123+
</xsl:otherwise>
124+
125+
</xsl:choose>
103126
<xsl:if test="count(basecompoundref) &gt; 1">
104127
<xsl:text> </xsl:text>
105128
</xsl:if>
106129
</xsl:for-each>
107130
</xsl:when>
108-
<xsl:when test="basecompoundref">
109-
<xsl:value-of select="concat(' extends ', basecompoundref)"/>
110-
</xsl:when>
111131
</xsl:choose>
112132
</codeblock>
133+
<xsl:call-template name="parse-brief-description"/>
113134
<xsl:call-template name="parse-detailed-description"/>
114135

136+
<xsl:if test="sectiondef/memberdef[@kind='typedef' and @prot='public']">
137+
<!-- Class typedef Summary -->
138+
<section class="- topic/section " outputclass="typedefs_summary">
139+
<title class="- topic/title ">
140+
<xsl:text>Types Summary</xsl:text>
141+
</title>
142+
<xsl:call-template name="add-typedefs-summary"/>
143+
</section>
144+
</xsl:if>
115145
<xsl:if test="sectiondef[contains(@kind,'-attrib')]/memberdef[@kind='variable' and @prot='public']">
116146
<!-- Class Field Summary -->
117147
<section class="- topic/section " outputclass="fields_summary">
@@ -143,6 +173,25 @@
143173
<xsl:call-template name="add-inherited-method-summary"/>
144174
</section>
145175

176+
<xsl:if test="sectiondef/memberdef[@kind='typedef'and @prot='public']">
177+
<!-- typedef Detail -->
178+
<section class="- topic/section " outputclass="typedefs">
179+
<xsl:attribute name="id">
180+
<xsl:value-of select="concat(compoundname, '_typedefs')"/>
181+
</xsl:attribute>
182+
<title class="- topic/title ">
183+
<xsl:text>Types Detail</xsl:text>
184+
</title>
185+
<xsl:apply-templates
186+
select="sectiondef/memberdef[@kind='typedef' and @prot='public']"
187+
mode="typedef"
188+
>
189+
<xsl:sort select="@id"/>
190+
</xsl:apply-templates>
191+
</section>
192+
</xsl:if>
193+
194+
146195
<xsl:if test="sectiondef[contains(@kind,'-attrib')]/memberdef[@kind='variable'and @prot='public']">
147196
<!-- field Detail -->
148197
<section class="- topic/section " outputclass="fields">
@@ -262,13 +311,11 @@
262311
<xsl:value-of select="$constructor"/>
263312
<xsl:call-template name="add-signature"/>
264313
</codeblock>
314+
<xsl:call-template name="parse-brief-description"/>
265315
<xsl:choose>
266-
<xsl:when test="detaileddescription/node()">
316+
<xsl:when test="detaileddescription/node()">
267317
<xsl:call-template name="parse-detailed-description"/>
268318
</xsl:when>
269-
<xsl:otherwise>
270-
<xsl:call-template name="parse-brief-description"/>
271-
</xsl:otherwise>
272319
</xsl:choose>
273320
<xsl:call-template name="parameter-description"/>
274321
</xsl:variable>
@@ -369,6 +416,7 @@
369416
</xsl:call-template>
370417
<xsl:value-of select="concat(' ',$field)"/>
371418
</codeph>
419+
<xsl:call-template name="parse-brief-description"/>
372420
<xsl:call-template name="parse-detailed-description"/>
373421
</xsl:variable>
374422

@@ -388,4 +436,93 @@
388436
</table>
389437
<p class="- topic/p "/>
390438
</xsl:template>
439+
440+
441+
<!--
442+
Typedefs Summary
443+
-->
444+
<xsl:template name="add-typedefs-summary">
445+
<table class="- topic/table " outputclass="typedefs_summary">
446+
<tgroup class="- topic/tgroup " cols="2">
447+
<colspec class="- topic/colspec " colname="c1" colnum="1" colwidth="25%"/>
448+
<colspec class="- topic/colspec " colname="c2" colnum="2" colwidth="75%"/>
449+
<thead class="- topic/thead ">
450+
<row class="- topic/row ">
451+
<entry class="- topic/entry " colname="c1" align="left">
452+
<xsl:text>Name</xsl:text>
453+
</entry>
454+
<entry class="- topic/entry " colname="c2" align="left">
455+
<xsl:text>Description</xsl:text>
456+
</entry>
457+
</row>
458+
</thead>
459+
<tbody class="- topic/tbody ">
460+
<xsl:for-each select="sectiondef/memberdef[@kind='typedef' and @prot='public']">
461+
<xsl:sort select="name"/>
462+
<xsl:variable name="field" select="name"/>
463+
<row class="- topic/row ">
464+
<entry class="- topic/entry " colname="c1" align="left">
465+
<codeph class="+ topic/ph pr-d/codeph ">
466+
<xsl:attribute name="xtrc" select="concat('codeph:',generate-id(.),'3')"/>
467+
<xsl:call-template name="add-link">
468+
<xsl:with-param name="type" select="'table'"/>
469+
<xsl:with-param name="href">
470+
<xsl:value-of
471+
select="concat('#', dita-ot:name-to-id(ancestor::compounddef/compoundname), '/typedefs_', $field)"
472+
/>
473+
<xsl:if test="count(../memberdef[name=$field])&gt;1">
474+
<xsl:value-of select="count(following-sibling::memberdef[name=$field])"/>
475+
</xsl:if>
476+
</xsl:with-param>
477+
<xsl:with-param name="text" select="$field"/>
478+
</xsl:call-template>
479+
</codeph>
480+
</entry>
481+
<entry class="- topic/entry " colname="c2" align="left">
482+
<xsl:if test="normalize-space(briefdescription)!=''">
483+
<xsl:value-of select="concat (' - ', briefdescription)"/>
484+
</xsl:if>
485+
</entry>
486+
</row>
487+
</xsl:for-each>
488+
</tbody>
489+
</tgroup>
490+
</table>
491+
</xsl:template>
492+
493+
494+
<!--
495+
typedef Details
496+
-->
497+
<xsl:template match="memberdef" mode="typedef">
498+
<xsl:variable name="field" select="name"/>
499+
<xsl:variable name="field_details">
500+
<codeph class="+ topic/ph pr-d/codeph ">
501+
<xsl:attribute name="xtrc" select="concat('codeph:',generate-id(.),'5')"/>
502+
<xsl:value-of select="concat(' ',./definition)"/>
503+
</codeph>
504+
<xsl:call-template name="parse-brief-description"/>
505+
<xsl:call-template name="parse-detailed-description"/>
506+
</xsl:variable>
507+
508+
<table class="- topic/table " outputclass="typedef_details">
509+
<xsl:attribute name="id">
510+
<xsl:value-of select="concat('typedefs_',$field)"/>
511+
<xsl:if test="count(../memberdef[name=$field])&gt;1">
512+
<xsl:value-of select="count(following-sibling::memberdef[name=$field])"/>
513+
</xsl:if>
514+
</xsl:attribute>
515+
<xsl:call-template name="mini-table">
516+
<xsl:with-param name="header">
517+
<xsl:value-of select="$field"/>
518+
</xsl:with-param>
519+
<xsl:with-param name="body" select="$field_details"/>
520+
</xsl:call-template>
521+
</table>
522+
<p class="- topic/p "/>
523+
</xsl:template>
524+
525+
526+
527+
391528
</xsl:stylesheet>

Customization/xsl/html-processing.xsl

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,14 @@
3030
</b>
3131
</p>
3232
</xsl:template>
33-
33+
34+
<!--
35+
Process white spaces in code blocks
36+
-->
37+
<xsl:template match="sp" mode="html">
38+
<xsl:text> </xsl:text>
39+
</xsl:template>
40+
3441
<!--
3542
Paragraph processing
3643
-->
@@ -47,6 +54,35 @@
4754
</xsl:choose>
4855
</xsl:template>
4956

57+
<!--
58+
description itemized list
59+
-->
60+
<xsl:template match="itemizedlist" mode="html">
61+
<ul class="- topic/ul ">
62+
<xsl:apply-templates mode="html"/>
63+
</ul>
64+
</xsl:template>
65+
<xsl:template match="itemizedlist/listitem" mode="html">
66+
<li class="- topic/li ">
67+
<xsl:apply-templates mode="html"/>
68+
</li>
69+
</xsl:template>
70+
71+
72+
73+
<!--
74+
Parameter list (ignore, since duplicated)
75+
-->
76+
<xsl:template match="parameterlist" mode="html">
77+
</xsl:template>
78+
79+
<!--
80+
simplesect kind=return return value doc (ignore, since duplicated)
81+
-->
82+
<xsl:template match="simplesect[@kind='return']" mode="html">
83+
</xsl:template>
84+
85+
5086
<!--
5187
Unordered list processing
5288
-->

Customization/xsl/method.xsl

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111

112112

113113
<xsl:variable name="inherited_methods">
114-
<xsl:text>Methods inherited from class </xsl:text>
114+
<xsl:text>Methods inherited from </xsl:text>
115115
<xsl:value-of select="concat ('Class ',replace($inherited_id, '::\w*$','::'))"/>
116116

117117
<xsl:call-template name="add-link">
@@ -323,30 +323,37 @@
323323
<xsl:template name="add-class-link">
324324
<xsl:param name="class"/>
325325
<xsl:variable name="refid" select="replace(replace($class, '^(interface|class)', ''), '_1_1', '.')"/>
326-
326+
<xsl:variable name="reftext" select="replace($refid,'^.*\.','')"/>
327327
<xsl:choose>
328328
<xsl:when test="//compounddef[@kind='class' and @id=$class]">
329329
<xsl:call-template name="add-link">
330330
<xsl:with-param name="type" select="'topic'"/>
331331
<xsl:with-param name="href" select="concat('#', $refid)"/>
332-
<xsl:with-param name="text" select="replace($refid,'^.*\.','')"/>
332+
<xsl:with-param name="text" select="$reftext"/>
333333
</xsl:call-template>
334334
</xsl:when>
335335
<xsl:when test="//compounddef[@kind='interface' and @id=$class]">
336336
<xsl:call-template name="add-link">
337337
<xsl:with-param name="type" select="'topic'"/>
338338
<xsl:with-param name="href" select="concat('#', $refid)"/>
339-
<xsl:with-param name="text" select="replace($refid,'^.*\.','')"/>
339+
<xsl:with-param name="text" select="$reftext"/>
340340
</xsl:call-template>
341341
</xsl:when>
342342
<xsl:when test="//compounddef[@kind='interface' and @id=$class]">
343343
<xsl:call-template name="add-link">
344344
<xsl:with-param name="type" select="'topic'"/>
345345
<xsl:with-param name="href" select="concat('#', $refid)"/>
346-
<xsl:with-param name="text" select="replace($refid,'^.*\.','')"/>
346+
<xsl:with-param name="text" select="$reftext"/>
347+
</xsl:call-template>
348+
</xsl:when>
349+
<xsl:when test="//memberdef[@id=$class]">
350+
<xsl:call-template name="add-link">
351+
<xsl:with-param name="type" select="'topic'"/>
352+
<xsl:with-param name="href" select="concat('#', $refid)"/>
353+
<xsl:with-param name="text" select="//memberdef[@id=$class]/name"/>
347354
</xsl:call-template>
348355
</xsl:when>
349-
<xsl:when test="starts-with($class,'java.lang.')">
356+
<xsl:when test="starts-with($class,'java.lang.')">
350357
<xsl:value-of select="dita-ot:addZeroWidthSpaces($class)"/>
351358
</xsl:when>
352359
<xsl:when test="$class">

Customization/xsl/package.xsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
<xsl:with-param name="text" select="replace(compoundname, '^.*::','')"/>
129129
</xsl:call-template>
130130
<xsl:if test="briefdescription">
131-
<xsl:value-of select="concat (' - ', briefdescription, detaileddescription/para[1])"/>
131+
<xsl:value-of select="briefdescription"/>
132132
</xsl:if>
133133
</li>
134134
</xsl:template>

xsl/doxygen2dita.xsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
<xsl:value-of select="$type"/>
106106
</xsl:attribute>
107107
<xsl:attribute name="href">
108-
<xsl:value-of select="$href"/>
108+
<xsl:value-of select="replace($href,'(&lt;)|(&gt;)','')"/>
109109
</xsl:attribute>
110110
<xsl:processing-instruction name="ditaot">
111111
<xsl:text>usertext</xsl:text>

0 commit comments

Comments
 (0)