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:
Peter Krempa
2022-04-05 16:52:57 +02:00
parent c72249674d
commit 98ffd82060
7 changed files with 21 additions and 47 deletions

View File

@@ -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', []),