Skip to content

Commit 343bd50

Browse files
committed
Add inheritance
1 parent 9ac0d43 commit 343bd50

File tree

5 files changed

+2201
-134
lines changed

5 files changed

+2201
-134
lines changed

Customization/xsl/class.xsl

Lines changed: 29 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -28,66 +28,49 @@
2828
<xsl:value-of select="replace(compoundname, '^.*::','')"/>
2929
</searchtitle>
3030
</titlealts>
31-
<body class="- topic/body " outputclass="java">
32-
<!--
33-
<xsl:variable name="class" select="@qualified"/>
34-
<xsl:variable name="extends" select="class/@qualified"/>
31+
<body class="- topic/body ">
32+
<xsl:attribute name="outputclass">
33+
<xsl:value-of select="dita-ot:prismjs(@language)"/>
34+
</xsl:attribute>
3535

36-
<xsl:if test="interface or //package/class[@qualified=$extends]/interface or @externalizable='true' or @serializable='true' ">
37-
<p class="- topic/p ">
38-
<b class=" hi-d/b ">
39-
<xsl:text>All Implemented Interfaces:</xsl:text>
40-
</b>
41-
</p>
42-
<ul class=" topic/ul ">
43-
<xsl:for-each select="interface">
44-
<li class=" topic/li ">
45-
<xsl:call-template name="add-link" >
46-
<xsl:with-param name="type" select="'topic'" />
47-
<xsl:with-param name="href" select="concat('#', @qualified)" />
48-
<xsl:with-param name="text" select="replace(@qualified,'^.*\.','')" />
49-
</xsl:call-template>
50-
</li>
51-
</xsl:for-each>
52-
<xsl:for-each select="//package/class[@qualified=$extends]/interface">
53-
<li class=" topic/li ">
54-
<xsl:call-template name="add-link" >
55-
<xsl:with-param name="type" select="'topic'" />
56-
<xsl:with-param name="href" select="concat('#', @qualified)" />
57-
<xsl:with-param name="text" select="replace(@qualified,'^.*\.','')" />
58-
</xsl:call-template>
59-
</li>
60-
</xsl:for-each>
61-
<xsl:if test="@externalizable='true'">
62-
<li class=" topic/li ">
63-
<xsl:text>java.io.Externalizable</xsl:text>
64-
</li>
65-
</xsl:if>
66-
<xsl:if test="@serializable='true'">
67-
<li class=" topic/li ">
68-
<xsl:text>java.io.Serializable</xsl:text>
69-
</li>
70-
</xsl:if>
71-
</ul>
36+
<xsl:if test="basecompoundref/@refid">
37+
<xsl:if test="starts-with(basecompoundref/@refid, 'interface')">
38+
<p class="- topic/p ">
39+
<b class=" hi-d/b ">
40+
<xsl:text>All Implemented Interfaces:</xsl:text>
41+
</b>
42+
</p>
43+
<ul class=" topic/ul ">
44+
<xsl:for-each select="basecompoundref">
45+
<li class=" topic/li ">
46+
<xsl:call-template name="add-link" >
47+
<xsl:with-param name="type" select="'topic'" />
48+
<xsl:with-param name="href" select="concat('#', .)" />
49+
<xsl:with-param name="text" select="." />
50+
</xsl:call-template>
51+
</li>
52+
</xsl:for-each>
53+
</ul>
54+
</xsl:if>
7255
</xsl:if>
73-
<xsl:if test="//package/class/class[@qualified=$class]">
56+
<xsl:if test="derivedcompoundref">
7457
<p class="- topic/p ">
7558
<b class=" hi-d/b ">
7659
<xsl:text>Direct Known Subclasses:</xsl:text>
7760
</b>
7861
</p>
7962
<ul class=" topic/ul ">
80-
<xsl:for-each select="//package/class/class[@qualified=$class]">
63+
<xsl:for-each select="derivedcompoundref">
8164
<li class=" topic/li ">
8265
<xsl:call-template name="add-link" >
8366
<xsl:with-param name="type" select="'topic'" />
84-
<xsl:with-param name="href" select="concat('#', parent::class/@qualified)" />
85-
<xsl:with-param name="text" select="parent::class/@name" />
67+
<xsl:with-param name="href" select="concat('#', .)" />
68+
<xsl:with-param name="text" select="." />
8669
</xsl:call-template>
8770
</li>
8871
</xsl:for-each>
8972
</ul>
90-
</xsl:if-->
73+
</xsl:if>
9174

9275
<codeblock class=" pr-d/codeblock ">
9376
<xsl:attribute name="xtrc" select="concat('codeblock:',generate-id(.),'1')"/>
@@ -136,7 +119,7 @@
136119
<xsl:if test="sectiondef[contains(@kind,'-func')]/memberdef[@kind='function' and not(type='') and @prot='public']">
137120
<xsl:call-template name="add-method-summary"/>
138121
</xsl:if>
139-
<!--xsl:call-template name="add-inherited-method-summary"/-->
122+
<xsl:call-template name="add-inherited-method-summary"/>
140123
</section>
141124

142125
<xsl:if test="sectiondef[contains(@kind,'-attrib')]/memberdef[@kind='variable'and @prot='public']">

Customization/xsl/method.xsl

Lines changed: 60 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -77,47 +77,59 @@
7777
</table>
7878
</xsl:template>
7979
<xsl:template name="add-inherited-method-summary">
80-
<xsl:variable name="extends">
81-
<xsl:value-of select="class/@qualified"/>
82-
</xsl:variable>
8380

84-
<xsl:choose>
85-
<xsl:when test="//package/class[@qualified=$extends]">
86-
<xsl:call-template name="inheritance-method-summary">
87-
<xsl:with-param name="extends" select = "//package/class[@qualified=$extends]/@qualified" />
88-
</xsl:call-template>
89-
</xsl:when>
90-
</xsl:choose>
81+
<xsl:variable name="current_id" select="@id"/>
82+
83+
<xsl:for-each select="inheritancegraph/node">
84+
<xsl:if test="childnode[@relation='public-inheritance']">
85+
<xsl:variable name="extends">
86+
<xsl:value-of select="link/@refid"/>
87+
</xsl:variable>
88+
<xsl:if test="link/@refid and $extends!=$current_id">
89+
<xsl:call-template name="inheritance-method-summary">
90+
<xsl:with-param name="extends" select = "//compounddef[@kind='class' and @id=$extends]" />
91+
</xsl:call-template>
92+
</xsl:if>
93+
</xsl:if>
94+
</xsl:for-each>
9195
</xsl:template>
9296

9397
<!--
9498
List methods from inherited classes
9599
-->
96100
<xsl:template name="inheritance-method-summary">
97101
<xsl:param name = "extends" />
98-
102+
103+
<xsl:variable name="inherited_id">
104+
<xsl:value-of select="$extends/compoundname"/>
105+
</xsl:variable>
106+
107+
99108
<xsl:variable name="inherited_methods">
100109
<xsl:text>Methods inherited from class </xsl:text>
101-
<xsl:value-of select="replace(@qualified,'\..*$','.')"/>
110+
<xsl:value-of select="concat ('Class ',replace($inherited_id, '::\w*$','::'))"/>
111+
102112
<xsl:call-template name="add-link" >
103113
<xsl:with-param name="type" select="'topic'" />
104-
<xsl:with-param name="href" select="concat('#', //package/class[@qualified=$extends]/@qualified)" />
105-
<xsl:with-param name="text" select="//package/class[@qualified=$extends]/@name" />
114+
<xsl:with-param name="href" select="concat('#', dita-ot:name-to-id($inherited_id))" />
115+
<xsl:with-param name="text" select="replace($inherited_id, '^.*::','')" />
106116
</xsl:call-template>
107117
</xsl:variable>
108118

119+
<!--xsl:variable name="inherited_methods_details" select="''" /-->
120+
109121
<xsl:variable name="inherited_methods_details">
110-
<xsl:for-each select="//package/class[@qualified=$extends]/method">
111-
<xsl:sort select="@name"/>
112-
<xsl:variable name="method" select="@name"/>
122+
<xsl:for-each select="$extends/sectiondef[contains(@kind,'-func')]/memberdef[@kind='function' and not(type='') and @prot='public']">
123+
<xsl:sort select="name"/>
124+
<xsl:variable name="method" select="name"/>
113125
<codeph class=" pr-d/codeph ">
114126
<xsl:attribute name="xtrc" select="concat('codeph:',generate-id(.),'14')"/>
115127
<xsl:call-template name="add-link" >
116128
<xsl:with-param name="type" select="'table'" />
117129
<xsl:with-param name="href">
118-
<xsl:value-of select="concat('#', $extends,'/methods_', $method)"/>
119-
<xsl:if test="count(../method[@name=$method])&gt;1">
120-
<xsl:value-of select="count(following-sibling::method[@name=$method])"/>
130+
<xsl:value-of select="concat('#', dita-ot:name-to-id($inherited_id),'/methods_', $method)"/>
131+
<xsl:if test="count(../memberdef[name=$method])&gt;1">
132+
<xsl:value-of select="count(following-sibling::memberdef[name=$method])"/>
121133
</xsl:if>
122134
</xsl:with-param>
123135
<xsl:with-param name="text" select="$method" />
@@ -136,17 +148,6 @@
136148
<xsl:with-param name="body" select="$inherited_methods_details"/>
137149
</xsl:call-template>
138150
</table>
139-
140-
<xsl:variable name="reextends">
141-
<xsl:value-of select="//package/class[@qualified=$extends]/class/@qualified"/>
142-
</xsl:variable>
143-
<xsl:choose>
144-
<xsl:when test="//package/class[@qualified=$reextends]">
145-
<xsl:call-template name="inheritance-method-summary" >
146-
<xsl:with-param name="extends" select = "//package/class[@qualified=$reextends]/@qualified" />
147-
</xsl:call-template>
148-
</xsl:when>
149-
</xsl:choose>
150151
</xsl:template>
151152

152153
<!--
@@ -175,6 +176,21 @@
175176
<xsl:call-template name="add-signature"/>
176177
</codeblock>
177178
<xsl:call-template name="parse-brief-description"/>
179+
180+
<xsl:if test="reimplements">
181+
<p class="- topic/p ">
182+
<b class=" hi-d/b ">
183+
<xsl:text>Overrides:</xsl:text>
184+
</b>
185+
</p>
186+
<xsl:call-template name="add-overrides">
187+
<xsl:with-param name="method" select="$method"/>
188+
<xsl:with-param name="refid" select="reimplements/@refid"/>
189+
</xsl:call-template>
190+
</xsl:if>
191+
192+
193+
178194
<xsl:call-template name="parameter-description"/>
179195
<xsl:call-template name="return-description"/>
180196
</xsl:variable>
@@ -257,35 +273,37 @@
257273
</xsl:template>
258274

259275
<xsl:template name="add-overrides">
260-
<xsl:param name="method"/>
261-
<xsl:param name="signature"/>
262-
<xsl:param name="extends"/>
263-
264-
276+
<xsl:param name="method"/>
277+
<xsl:param name="refid"/>
278+
279+
<xsl:variable name="extends" select="//member[@refid=$refid]/ancestor::compounddef"/>
280+
281+
<xsl:for-each select="$extends/compoundname">
265282
<p class="- topic/p ">
266283
<codeph class=" pr-d/codeph ">
267284
<xsl:attribute name="xtrc" select="concat('codeph:',generate-id(.),'17')"/>
268285
<xsl:call-template name="add-link" >
269286
<xsl:with-param name="type" select="'table'" />
270287
<xsl:with-param name="href">
271-
<xsl:value-of select="concat('#', $extends, '/methods_', $method)" />
272-
<xsl:if test="count(//package/class[@qualified=$extends]/method[@name=$method])&gt;1">
273-
<xsl:value-of select="count(//package/class[@qualified=$extends]/method[@name=$method and @signature=$signature]/following-sibling::method[@name=$method])"/>
288+
<xsl:value-of select="concat('#', dita-ot:name-to-id(.), '/methods_', $method)" />
289+
<xsl:if test="count($extends/sectiondef/memberdef[name=$method])&gt;1">
290+
<xsl:value-of select="count($extends/sectiondef/memberdef[@id=$refid]/following-sibling::memberdef[name=$method])"/>
274291
</xsl:if>
275292
</xsl:with-param>
276-
<xsl:with-param name="text" select="replace(@qualified,'^.*\.','')" />
293+
<xsl:with-param name="text" select="$method" />
277294
</xsl:call-template>
278295
</codeph>
279296
<xsl:text> in class </xsl:text>
280297
<codeph class=" pr-d/codeph ">
281298
<xsl:attribute name="xtrc" select="concat('codeph:',generate-id(.),'18')"/>
282299
<xsl:call-template name="add-link" >
283300
<xsl:with-param name="type" select="'topic'" />
284-
<xsl:with-param name="href" select="concat('#', $extends)" />
285-
<xsl:with-param name="text" select="replace($extends,'^.*\.','')" />
301+
<xsl:with-param name="href" select="concat('#', dita-ot:name-to-id(.))" />
302+
<xsl:with-param name="text" select="replace(.,'^.*::','')" />
286303
</xsl:call-template>
287304
</codeph>
288305
</p>
306+
</xsl:for-each>
289307
</xsl:template>
290308
<!---
291309
-->

0 commit comments

Comments
 (0)