[libvirt PATCH] docs: fix libvirt go-import metadata in pages

Daniel P. Berrangé posted 1 patch 3 years, 7 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20200804155256.4099540-1-berrange@redhat.com
docs/newapi.xsl           | 2 --
docs/page.xsl             | 7 +++----
docs/site.xsl             | 3 +--
docs/subsite.xsl          | 1 -
scripts/meson-html-gen.py | 4 ----
5 files changed, 4 insertions(+), 13 deletions(-)
[libvirt PATCH] docs: fix libvirt go-import metadata in pages
Posted by Daniel P. Berrangé 3 years, 7 months ago
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.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 docs/newapi.xsl           | 2 --
 docs/page.xsl             | 7 +++----
 docs/site.xsl             | 3 +--
 docs/subsite.xsl          | 1 -
 scripts/meson-html-gen.py | 4 ----
 5 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/docs/newapi.xsl b/docs/newapi.xsl
index 0dc4f7ae52..7ac8caa35d 100644
--- a/docs/newapi.xsl
+++ b/docs/newapi.xsl
@@ -835,7 +835,6 @@
       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>
@@ -851,7 +850,6 @@
         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>
diff --git a/docs/page.xsl b/docs/page.xsl
index bdd57ba2e0..9ab8d3dd69 100644
--- a/docs/page.xsl
+++ b/docs/page.xsl
@@ -76,14 +76,13 @@
 
   <!-- 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>
@@ -100,10 +99,10 @@
         <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"/>
diff --git a/docs/site.xsl b/docs/site.xsl
index 73ddd8ca6b..931e26272f 100644
--- a/docs/site.xsl
+++ b/docs/site.xsl
@@ -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>
diff --git a/docs/subsite.xsl b/docs/subsite.xsl
index bfd34eebd2..2bdfcbb9b1 100644
--- a/docs/subsite.xsl
+++ b/docs/subsite.xsl
@@ -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>
diff --git a/scripts/meson-html-gen.py b/scripts/meson-html-gen.py
index dbf238de54..2731d734a7 100755
--- a/scripts/meson-html-gen.py
+++ b/scripts/meson-html-gen.py
@@ -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,
-- 
2.26.2

Re: [libvirt PATCH] docs: fix libvirt go-import metadata in pages
Posted by Pavel Hrdina 3 years, 7 months ago
On Tue, Aug 04, 2020 at 04:52:56PM +0100, Daniel P. Berrangé wrote:
> 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.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  docs/newapi.xsl           | 2 --
>  docs/page.xsl             | 7 +++----
>  docs/site.xsl             | 3 +--
>  docs/subsite.xsl          | 1 -
>  scripts/meson-html-gen.py | 4 ----
>  5 files changed, 4 insertions(+), 13 deletions(-)

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>