]> xenbits.xensource.com Git - libvirt.git/commitdiff
docs: add a permalink to html headers
authorDan Kenigsberg <danken@redhat.com>
Sun, 8 Dec 2013 14:05:46 +0000 (14:05 +0000)
committerClaudio Bley <cbley@av-test.de>
Mon, 27 Jan 2014 07:42:09 +0000 (08:42 +0100)
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.

docs/libvirt.css
docs/page.xsl

index b324ac88c76991b886873f746edc6ef371359b16..1d27873d930ae291c7ba8b6d2750f0daa4e3fdb8 100644 (file)
@@ -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;
+}
index a2da85416af9795a2ccdbc63f8a8777584c61a95..d560c0998a8ec411879cf771546e3383000fd8d8 100644 (file)
 
     <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>