]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
man: include the target name when linking to man pages in html output 1990/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 23 Nov 2015 04:43:36 +0000 (23:43 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 23 Nov 2015 04:54:29 +0000 (23:54 -0500)
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 https://github.com/systemd/systemd/issues/1956.

man/custom-html.xsl
tools/make-directive-index.py

index 84c23014e4bf255e045828a72ab933dd288687f1..e89d73e7f1dc9f126aba781bc5f11a2f4869876c 100644 (file)
@@ -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>
index 17b1325bba62647e4e2b74d74415dcfa8a7e1c12..8091683feed9a572dcf1ec5adc1c9b6d4f539b4d 100755 (executable)
@@ -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'