X Tutup
Skip to content

Commit 958caa5

Browse files
committed
man: include the target name when linking to man pages in html output
Links like http://www.freedesktop.org/software/systemd/man/systemd.socket.html are changed to http://www.freedesktop.org/software/systemd/man/systemd.socket.html#Accept=. This implementation is quick & dirty, and misses various corner cases. A fairly important one is that when a few directives share the same anchor (which happens when multiple directives are described in the same paragraph), generated links for everything except the first one link to an invalid anchor. Another shortcoming is that the formatting does not use the proper generateID machinery, so the anchor name could be wrong in some cases. But it seems to work for a large percentage of links, so seems to be an improvement in usability. When the anchor is missing, we land at the top of the page, which is the same as before. If the anchor were to point to different spot, this would be more confusing... Not sure if that ever happens. Anyway, the user should be able to recover from landing on the wrong place in the page. (Mostly) fixes systemd#1956.
1 parent b591613 commit 958caa5

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

man/custom-html.xsl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
<xsl:template match="citerefentry[not(@project)]">
3838
<a>
3939
<xsl:attribute name="href">
40-
<xsl:value-of select="refentrytitle"/><xsl:text>.html</xsl:text>
40+
<xsl:value-of select="refentrytitle"/><xsl:text>.html#</xsl:text>
41+
<xsl:value-of select="refentrytitle/@target"/>
4142
</xsl:attribute>
4243
<xsl:call-template name="inline.charseq"/>
4344
</a>

tools/make-directive-index.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ def _make_section(template, name, directives, formatting):
268268
b = tree.SubElement(para, 'citerefentry')
269269
c = tree.SubElement(b, 'refentrytitle')
270270
c.text = manpage
271+
c.attrib['target'] = varname
271272
d = tree.SubElement(b, 'manvolnum')
272273
d.text = manvolume
273274
entry.tail = '\n\n'

0 commit comments

Comments
 (0)
X Tutup