docs: fix libvirt go-import metadata in pages and links in 404 page

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>
This commit is contained in:
Daniel P. Berrangé 2020-08-04 14:33:15 +01:00
parent abab5c47f8
commit 08376431b4
5 changed files with 4 additions and 13 deletions

View File

@ -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>

View File

@ -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"/>

View 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>

View 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>

View File

@ -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,