Skip to content

Commit

Permalink
man: include the target name when linking to man pages in html output
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
keszybz committed Nov 23, 2015
1 parent b591613 commit 958caa5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion man/custom-html.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
<xsl:template match="citerefentry[not(@project)]">
<a>
<xsl:attribute name="href">
<xsl:value-of select="refentrytitle"/><xsl:text>.html</xsl:text>
<xsl:value-of select="refentrytitle"/><xsl:text>.html#</xsl:text>
<xsl:value-of select="refentrytitle/@target"/>
</xsl:attribute>
<xsl:call-template name="inline.charseq"/>
</a>
Expand Down
1 change: 1 addition & 0 deletions tools/make-directive-index.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ def _make_section(template, name, directives, formatting):
b = tree.SubElement(para, 'citerefentry')
c = tree.SubElement(b, 'refentrytitle')
c.text = manpage
c.attrib['target'] = varname
d = tree.SubElement(b, 'manvolnum')
d.text = manvolume
entry.tail = '\n\n'
Expand Down

0 comments on commit 958caa5

Please sign in to comment.