[PATCH v2 05/15] docs: generate permalinks correctly for rst2html output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The rst2html output generates the links for headings in a slightly
different way than we do for docs written in HTML, so we must match
another scenario when generating back links.

rst2html will also use <h1> tags for both the document title and
the first level of section titles, so we must expand the matching
to allow for this too.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 docs/libvirt.css | 1 +
 docs/page.xsl    | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/docs/libvirt.css b/docs/libvirt.css
index e927a084a7..399404ca54 100644
--- a/docs/libvirt.css
+++ b/docs/libvirt.css
@@ -419,6 +419,7 @@ a.headerlink {
     visibility: hidden;
 }
 
+h1:hover > a.headerlink,
 h2:hover > a.headerlink,
 h3:hover > a.headerlink,
 h4:hover > a.headerlink,
diff --git a/docs/page.xsl b/docs/page.xsl
index 70dfec6df6..f8f7ff8cf9 100644
--- a/docs/page.xsl
+++ b/docs/page.xsl
@@ -176,12 +176,15 @@
     <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:template match="html:h1 | html:h2 | html:h3 | html:h4 | html:h5 | html:h6" mode="content">
     <xsl:element name="{name()}">
       <xsl:apply-templates mode="copy" />
       <xsl:if test="./html:a/@id">
         <a class="headerlink" href="#{html:a/@id}" title="Permalink to this headline">&#xb6;</a>
       </xsl:if>
+      <xsl:if test="./html:a[@class='toc-backref']">
+        <a class="headerlink" href="#{../@id}" title="Permalink to this headline">&#xb6;</a>
+      </xsl:if>
     </xsl:element>
   </xsl:template>
 
-- 
2.23.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux