Skip to content

Commit f4ebf8c

Browse files
author
Phillip Webb
committed
Add clickable anchors to HTML docs
Fixes spring-projectsgh-525
1 parent b697191 commit f4ebf8c

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

spring-boot-docs/src/main/docbook/css/manual.css

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,3 +311,31 @@ div.navheader {
311311
div.navfooter {
312312
border-top: 1px solid #CCCCCC;
313313
}
314+
315+
.title {
316+
margin-left: -1em;
317+
padding-left: 1em;
318+
}
319+
320+
.title>a {
321+
position: absolute;
322+
visibility: hidden;
323+
display: block;
324+
font-size: 0.85em;
325+
margin-top: 0.05em;
326+
margin-left: -1em;
327+
vertical-align: text-top;
328+
color: black;
329+
}
330+
331+
.title>a:before {
332+
content: "\00A7";
333+
}
334+
335+
.title:hover>a,.title>a:hover,.title:hover>a:hover {
336+
visibility: visible;
337+
}
338+
339+
.title:focus>a,.title>a:focus,.title:focus>a:focus {
340+
outline: 0;
341+
}

spring-boot-docs/src/main/docbook/xsl/html.xsl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,27 @@ under the License.
114114
<xsl:apply-templates mode="titlepage.mode"/>
115115
</div>
116116
</xsl:template>
117+
118+
<!-- Title Links -->
119+
<xsl:template name="anchor">
120+
<xsl:param name="node" select="."/>
121+
<xsl:param name="conditional" select="1"/>
122+
<xsl:variable name="id">
123+
<xsl:call-template name="object.id">
124+
<xsl:with-param name="object" select="$node"/>
125+
</xsl:call-template>
126+
</xsl:variable>
127+
<xsl:if test="$conditional = 0 or $node/@id or $node/@xml:id">
128+
<xsl:element name="a">
129+
<xsl:attribute name="name">
130+
<xsl:value-of select="$id"/>
131+
</xsl:attribute>
132+
<xsl:attribute name="href">
133+
<xsl:text>#</xsl:text>
134+
<xsl:value-of select="$id"/>
135+
</xsl:attribute>
136+
</xsl:element>
137+
</xsl:if>
138+
</xsl:template>
139+
117140
</xsl:stylesheet>

0 commit comments

Comments
 (0)