]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
docs: fix libvirt go-import metadata in pages and links in 404 page
authorDaniel P. Berrangé <berrange@redhat.com>
Tue, 4 Aug 2020 13:33:15 +0000 (14:33 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Tue, 4 Aug 2020 16:06:33 +0000 (17:06 +0100)
The meson conversion lost the <meta> tags providing the go-import,
because the "$pagename" variable lost the .html suffix. Rather
than fix that, just change to using "$pagesrc" instead, as it is a
better fit.

The 404 page also needs to use absolute links to work correctly for
pages in sub-folders.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
docs/newapi.xsl
docs/page.xsl
docs/site.xsl
docs/subsite.xsl
scripts/meson-html-gen.py

index 0dc4f7ae52212171df113fb1ff215e910bc7230c..7ac8caa35d584776adbbdea88a7b9158247ea6c8 100644 (file)
       indent="yes"
       encoding="UTF-8">
       <xsl:apply-templates select="exsl:node-set($mainpage)" mode="page">
-        <xsl:with-param name="pagename" select="concat($htmldir, '', $indexfile)"/>
         <xsl:with-param name="timestamp" select="$timestamp"/>
       </xsl:apply-templates>
     </xsl:document>
         indent="yes"
         encoding="UTF-8">
         <xsl:apply-templates select="exsl:node-set($subpage)" mode="page">
-          <xsl:with-param name="pagename" select="concat($htmldir, '/libvirt-', @name, '.html')"/>
           <xsl:with-param name="timestamp" select="$timestamp"/>
         </xsl:apply-templates>
       </xsl:document>
index bdd57ba2e0e1cd0d47317911250a23b1347654c3..9ab8d3dd69cf0dd2cc05fbd029f93e2f6a6ba532 100644 (file)
 
   <!-- This is the master page structure -->
   <xsl:template match="/" mode="page">
-    <xsl:param name="pagename"/>
     <xsl:param name="pagesrc"/>
     <xsl:param name="timestamp"/>
     <xsl:text disable-output-escaping="yes">&lt;!DOCTYPE html&gt;
 </xsl:text>
     <html>
       <xsl:comment>
-        This file is autogenerated from <xsl:value-of select="$pagename"/>.in
+        This file is autogenerated from <xsl:value-of select="$pagesrc"/>
         Do not edit this file. Changes will be lost.
       </xsl:comment>
       <xsl:comment>
         <meta name="theme-color" content="#ffffff"/>
         <title>libvirt: <xsl:value-of select="html:html/html:body//html:h1"/></title>
         <meta name="description" content="libvirt, virtualization, virtualization API"/>
-        <xsl:if test="$pagename = 'libvirt-go.html'">
+        <xsl:if test="$pagesrc = 'docs/libvirt-go.rst'">
           <meta name="go-import" content="libvirt.org/libvirt-go git https://libvirt.org/git/libvirt-go.git"/>
         </xsl:if>
-        <xsl:if test="$pagename = 'libvirt-go-xml.html'">
+        <xsl:if test="$pagesrc = 'docs/libvirt-go-xml.rst'">
           <meta name="go-import" content="libvirt.org/libvirt-go-xml git https://libvirt.org/git/libvirt-go-xml.git"/>
         </xsl:if>
         <xsl:apply-templates select="/html:html/html:head/html:script" mode="content"/>
index 73ddd8ca6b33ffda4284cdece85abec15213d735..931e26272fd740a03fe4a120ff3e805c15449d59 100644 (file)
@@ -15,7 +15,7 @@
 
   <xsl:variable name="href_base">
     <xsl:choose>
-      <xsl:when test="$pagename = '404.html'">
+      <xsl:when test="$pagesrc = 'docs/404.html.in'">
         <xsl:value-of select="'/'"/>
       </xsl:when>
       <xsl:otherwise>
@@ -26,7 +26,6 @@
 
   <xsl:template match="/">
     <xsl:apply-templates select="." mode="page">
-      <xsl:with-param name="pagename" select="$pagename"/>
       <xsl:with-param name="pagesrc" select="$pagesrc"/>
       <xsl:with-param name="timestamp" select="$timestamp"/>
     </xsl:apply-templates>
index bfd34eebd2748faf073a4ef7c975d5dcbdffbd26..2bdfcbb9b1990a349be23bf9c523bfae99b8f4ba 100644 (file)
@@ -16,7 +16,6 @@
 
   <xsl:template match="/">
     <xsl:apply-templates select="." mode="page">
-      <xsl:with-param name="pagename" select="$pagename"/>
       <xsl:with-param name="pagesrc" select="$pagesrc"/>
       <xsl:with-param name="timestamp" select="$timestamp"/>
     </xsl:apply-templates>
index dbf238de540877f6c1b04680624d81250ca0d8cf..2731d734a7d55614ac355360a13ac7a2acb94fbd 100755 (executable)
@@ -1,7 +1,6 @@
 #!/usr/bin/env python3
 
 import argparse
-import os
 import subprocess
 
 parser = argparse.ArgumentParser()
@@ -15,12 +14,9 @@ parser.add_argument("htmlfile", type=str, help="path to generated HTML file")
 parser.add_argument("pagesrc", type=str, default="", nargs='?', help="(optional) path to source file used for edit this page")
 args = parser.parse_args()
 
-name = os.path.basename(args.htmlfile).replace('.html', '')
-
 html_tmp = subprocess.run(
     [
         args.xsltproc,
-        '--stringparam', 'pagename', name,
         '--stringparam', 'pagesrc', args.pagesrc,
         '--stringparam', 'builddir', args.builddir,
         '--stringparam', 'timestamp', args.timestamp,