提交 237a088b 编写于 作者: D Dan Kenigsberg 提交者: Claudio Bley

docs: add a permalink to html headers

Quite often, I need to cite URLs like
    http://libvirt.org/formatnetwork.html#elementQoS
but it is annoying to copy them from the table of contents or the html
source.

This patch borrows from the Python documentation in order to make it
easier to cite headers on libvirt's oneline documentation.
上级 29ea437e
......@@ -498,3 +498,16 @@ div.description pre.code {
padding: 5px 10px 5px 10px;
margin-left: 2.5em;
}
a.headerlink {
text-decoration: none!important;
visibility: hidden;
}
h2:hover > a.headerlink,
h3:hover > a.headerlink,
h4:hover > a.headerlink,
h5:hover > a.headerlink,
h6:hover > a.headerlink {
visibility: visible;
}
......@@ -185,4 +185,24 @@
<xsl:apply-templates select="exsl:node-set($inchtml)/html:html/html:body/*" mode="content"/>
</xsl:template>
<xsl:template match="html:h2 | html:h3 | html:h4 | html:h5 | html:h6" mode="content">
<xsl:element name="{name()}" namespace="{namespace-uri()}">
<xsl:apply-templates mode="copy" />
<xsl:if test="./html:a/@name">
<a class="headerlink" href="#{html:a/@name}" title="Permalink to this headline">&#xb6;</a>
</xsl:if>
</xsl:element>
</xsl:template>
<xsl:template match="text()" mode="copy">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="node()" mode="copy">
<xsl:element name="{name()}" namespace="{namespace-uri()}">
<xsl:copy-of select="./@*"/>
<xsl:apply-templates mode="copy" />
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册