mirror of https://gitee.com/openkylin/libvirt.git
docs: Simplify passing of 'href_base' XSL variable
Historically we had two top level XSL files for top level and nested documents which only differ in what they pass for 'href_base' to the main 'page.xsl' file. We can instead pass the variable as argument from the build system so that we have just one XSL file and also allow for more nested document trees in the future. The '404' page is special even with the current XSL way so we add a special case for it. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
c72249674d
commit
98ffd82060
|
@ -3,7 +3,6 @@ docs_go_files = [
|
|||
'libvirtxml',
|
||||
]
|
||||
|
||||
html_xslt_gen_xslt = subsite_xsl
|
||||
html_xslt_gen_install_dir = docs_html_dir / 'go'
|
||||
html_xslt_gen = []
|
||||
|
||||
|
@ -14,6 +13,7 @@ foreach name : docs_go_files
|
|||
'name': name,
|
||||
'file': docs_rst2html5_gen.process(rst_file),
|
||||
'source': 'docs' / 'go' / rst_file,
|
||||
'href_base': '../',
|
||||
}
|
||||
endforeach
|
||||
|
||||
|
@ -33,8 +33,9 @@ foreach data : html_xslt_gen
|
|||
'--stringparam', 'pagesrc', data.get('source', ''),
|
||||
'--stringparam', 'builddir', meson.build_root(),
|
||||
'--stringparam', 'timestamp', docs_timestamp,
|
||||
'--stringparam', 'href_base', data.get('href_base', ''),
|
||||
'--nonet',
|
||||
html_xslt_gen_xslt,
|
||||
site_xsl,
|
||||
'@INPUT@',
|
||||
],
|
||||
depends: data.get('depends', []),
|
||||
|
|
|
@ -5,7 +5,6 @@ internals_in_files = [
|
|||
'rpc',
|
||||
]
|
||||
|
||||
html_xslt_gen_xslt = subsite_xsl
|
||||
html_xslt_gen_install_dir = docs_html_dir / 'internals'
|
||||
html_xslt_gen = []
|
||||
|
||||
|
@ -13,6 +12,7 @@ foreach name : internals_in_files
|
|||
html_xslt_gen += {
|
||||
'name': name,
|
||||
'source': 'docs' / 'internals' / name + '.html.in',
|
||||
'href_base': '../'
|
||||
}
|
||||
endforeach
|
||||
|
||||
|
@ -32,8 +32,9 @@ foreach data : html_xslt_gen
|
|||
'--stringparam', 'pagesrc', data.get('source', ''),
|
||||
'--stringparam', 'builddir', meson.build_root(),
|
||||
'--stringparam', 'timestamp', docs_timestamp,
|
||||
'--stringparam', 'href_base', data.get('href_base', ''),
|
||||
'--nonet',
|
||||
html_xslt_gen_xslt,
|
||||
site_xsl,
|
||||
'@INPUT@',
|
||||
],
|
||||
depends: data.get('depends', []),
|
||||
|
|
|
@ -24,7 +24,6 @@ docs_kbase_files = [
|
|||
'virtiofs',
|
||||
]
|
||||
|
||||
html_xslt_gen_xslt = subsite_xsl
|
||||
html_xslt_gen_install_dir = docs_html_dir / 'kbase'
|
||||
html_xslt_gen = []
|
||||
|
||||
|
@ -35,6 +34,7 @@ foreach name : docs_kbase_files
|
|||
'name': name,
|
||||
'file': docs_rst2html5_gen.process(rst_file),
|
||||
'source': 'docs' / 'kbase' / rst_file,
|
||||
'href_base': '../',
|
||||
}
|
||||
endforeach
|
||||
|
||||
|
@ -54,8 +54,9 @@ foreach data : html_xslt_gen
|
|||
'--stringparam', 'pagesrc', data.get('source', ''),
|
||||
'--stringparam', 'builddir', meson.build_root(),
|
||||
'--stringparam', 'timestamp', docs_timestamp,
|
||||
'--stringparam', 'href_base', data.get('href_base', ''),
|
||||
'--nonet',
|
||||
html_xslt_gen_xslt,
|
||||
site_xsl,
|
||||
'@INPUT@',
|
||||
],
|
||||
depends: data.get('depends', []),
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
html_xslt_gen_xslt = subsite_xsl
|
||||
html_xslt_gen_install_dir = docs_html_dir / 'manpages'
|
||||
html_xslt_gen = []
|
||||
|
||||
|
@ -130,6 +129,7 @@ foreach data : docs_man_files
|
|||
'name': data['name'],
|
||||
'file': html_in,
|
||||
'source': 'docs' / 'manpages' / rst_in_file,
|
||||
'href_base': '../',
|
||||
}
|
||||
endforeach
|
||||
|
||||
|
@ -149,8 +149,9 @@ foreach data : html_xslt_gen
|
|||
'--stringparam', 'pagesrc', data.get('source', ''),
|
||||
'--stringparam', 'builddir', meson.build_root(),
|
||||
'--stringparam', 'timestamp', docs_timestamp,
|
||||
'--stringparam', 'href_base', data.get('href_base', ''),
|
||||
'--nonet',
|
||||
html_xslt_gen_xslt,
|
||||
site_xsl,
|
||||
'@INPUT@',
|
||||
],
|
||||
depends: data.get('depends', []),
|
||||
|
|
|
@ -18,7 +18,6 @@ docs_assets = [
|
|||
]
|
||||
|
||||
docs_html_in_files = [
|
||||
'404',
|
||||
'docs',
|
||||
'formatcaps',
|
||||
'formatnetwork',
|
||||
|
@ -132,7 +131,6 @@ docs_timestamp = run_command(
|
|||
).stdout().strip()
|
||||
|
||||
site_xsl = files('site.xsl')
|
||||
subsite_xsl = files('subsite.xsl')
|
||||
page_xsl = files('page.xsl')
|
||||
newapi_xsl = files('newapi.xsl')
|
||||
|
||||
|
@ -218,7 +216,6 @@ docs_rst2html5_gen = generator(
|
|||
|
||||
# html_xslt_gen config
|
||||
|
||||
html_xslt_gen_xslt = site_xsl
|
||||
html_xslt_gen_install_dir = docs_html_dir
|
||||
|
||||
html_xslt_gen = []
|
||||
|
@ -251,6 +248,12 @@ html_xslt_gen += {
|
|||
'depends': aclperms_gen,
|
||||
}
|
||||
|
||||
html_xslt_gen += {
|
||||
'name': '404',
|
||||
'source': 'docs' / '404.html.in',
|
||||
'href_base': '/',
|
||||
}
|
||||
|
||||
hvsupport_html_in = custom_target(
|
||||
'hvsupport.html.in',
|
||||
output: 'hvsupport.html.in',
|
||||
|
@ -302,8 +305,9 @@ foreach data : html_xslt_gen
|
|||
'--stringparam', 'pagesrc', data.get('source', ''),
|
||||
'--stringparam', 'builddir', meson.build_root(),
|
||||
'--stringparam', 'timestamp', docs_timestamp,
|
||||
'--stringparam', 'href_base', data.get('href_base', ''),
|
||||
'--nonet',
|
||||
html_xslt_gen_xslt,
|
||||
site_xsl,
|
||||
'@INPUT@',
|
||||
],
|
||||
depends: data.get('depends', []),
|
||||
|
|
|
@ -13,21 +13,11 @@
|
|||
encoding="UTF-8"
|
||||
indent="yes"/>
|
||||
|
||||
<xsl:variable name="href_base">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$pagesrc = 'docs/404.html.in'">
|
||||
<xsl:value-of select="'/'"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="''"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:apply-templates select="." mode="page">
|
||||
<xsl:with-param name="pagesrc" select="$pagesrc"/>
|
||||
<xsl:with-param name="timestamp" select="$timestamp"/>
|
||||
<xsl:with-param name="href_base" select="$href_base"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:template>
|
||||
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:exsl="http://exslt.org/common"
|
||||
exclude-result-prefixes="xsl exsl"
|
||||
version="1.0">
|
||||
|
||||
<xsl:import href="page.xsl"/>
|
||||
|
||||
<xsl:output
|
||||
method="xml"
|
||||
encoding="UTF-8"
|
||||
indent="yes"/>
|
||||
|
||||
<xsl:variable name="href_base" select="'../'"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:apply-templates select="." mode="page">
|
||||
<xsl:with-param name="pagesrc" select="$pagesrc"/>
|
||||
<xsl:with-param name="timestamp" select="$timestamp"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
Loading…
Reference in New Issue