Skip to content

Commit 7643cec

Browse files
committed
Fix rendering of issues with empty namespace, add ankers for faster navigatin to c/i/t area
1 parent e5c0592 commit 7643cec

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

templates/html/index.xsl

+25-10
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,16 @@
2828
<div class="wrapper clearfix">
2929
<div class="topbar clearfix">
3030
<h1><a class="brand" href="./index.html"><xsl:value-of select="$project/@name" /> - API Documentation</a></h1>
31+
<span style="float:right; padding-right:10px;">
32+
<a href="#classes">Classes</a> | <a href="#interfaces">Interfaces</a> | <a href="#traits">Traits</a>
33+
</span>
3134
</div>
3235

3336
<div class="indexcontent">
3437
<h2><xsl:value-of select="$project/@name" /></h2>
3538
<p>Welcome to the API documentation page. Please select one of the listed classes, interfaces or traits to learn more about the indivdual item. You can navigate back to this page by use of the top navigation bar.</p>
3639

40+
<a name="classes" />
3741
<h3>Classes</h3>
3842
<xsl:choose>
3943
<xsl:when test="//file:class">
@@ -47,7 +51,9 @@
4751
</xsl:choose>
4852

4953
<div class="clearfix" />
50-
<h3>Interfaces</h3>
54+
55+
<a name="interfaces" />
56+
<h3 class="separator">Interfaces</h3>
5157
<xsl:choose>
5258
<xsl:when test="//file:interface">
5359
<xsl:apply-templates select="//file:namespace[file:interface]" mode="interface">
@@ -60,7 +66,9 @@
6066
</xsl:choose>
6167

6268
<div class="clearfix" />
63-
<h3>Traits</h3>
69+
70+
<a name="traits" />
71+
<h3 class="separator">Traits</h3>
6472
<xsl:choose>
6573
<xsl:when test="//file:trait">
6674
<xsl:apply-templates select="//file:namespace[file:trait]" mode="trait">
@@ -79,9 +87,18 @@
7987
</html>
8088
</xsl:template>
8189

90+
<xsl:template match="file:namespace">
91+
<h4>
92+
<xsl:choose>
93+
<xsl:when test="not(@name = '')"><xsl:value-of select="@name" /></xsl:when>
94+
<xsl:otherwise>/</xsl:otherwise>
95+
</xsl:choose>
96+
</h4>
97+
</xsl:template>
98+
8299
<xsl:template match="file:namespace" mode="class">
83100
<div class="linkbox">
84-
<h4><xsl:value-of select="@name" /></h4>
101+
<xsl:apply-templates select="." />
85102
<ul class="linklist">
86103
<xsl:apply-templates select="file:class">
87104
<xsl:sort select="@name" order="ascending" />
@@ -91,7 +108,7 @@
91108
</xsl:template>
92109

93110
<xsl:template match="file:namespace" mode="interface">
94-
<h4><xsl:value-of select="@name" /></h4>
111+
<xsl:apply-templates select="." />
95112
<ul class="linklist">
96113
<xsl:apply-templates select="file:interface">
97114
<xsl:sort select="@name" order="ascending" />
@@ -100,7 +117,7 @@
100117
</xsl:template>
101118

102119
<xsl:template match="file:namespace" mode="trait">
103-
<h4><xsl:value-of select="@name" /></h4>
120+
<xsl:apply-templates select="." />
104121
<ul class="linklist">
105122
<xsl:apply-templates select="file:trait">
106123
<xsl:sort select="@name" order="ascending" />
@@ -110,14 +127,12 @@
110127

111128
<xsl:template match="file:class|file:interface|file:trait">
112129
<li>
113-
<xsl:variable name="link">
114-
<xsl:choose>
130+
<xsl:variable name="link"><xsl:choose>
115131
<xsl:when test="local-name(.) = 'class'">classes</xsl:when>
116132
<xsl:when test="local-name(.) = 'interface'">interfaces</xsl:when>
117133
<xsl:otherwise>traits</xsl:otherwise>
118-
</xsl:choose>
119-
</xsl:variable>
120-
<a href="{$link}/{translate(../@name, '\', '_')}_{@name}.{$extension}"><xsl:value-of select="@name" /></a>
134+
</xsl:choose>/<xsl:value-of select="translate(../@name, '\', '_')" /><xsl:if test="not(../@name = '')">_</xsl:if><xsl:value-of select="@name" />.<xsl:value-of select="$extension" /></xsl:variable>
135+
<a href="{$link}"><xsl:value-of select="@name" /></a>
121136
</li>
122137
</xsl:template>
123138

0 commit comments

Comments
 (0)