docs: xsl: Simplify templating XSL

Wrap the auto-generated pages (API ref and hvsupport.html) in the proper
top level element similarly to what the pages generated from RST have to
remove the extra case when templating our web.

(Best viewed with 'git show -w')

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2023-05-17 14:17:56 +02:00
parent f11c773014
commit 5ee27c37e6
3 changed files with 51 additions and 59 deletions

View File

@ -733,54 +733,56 @@
</xsl:text>
<html>
<body>
<h1><xsl:value-of select="$title"/></h1>
<xsl:call-template name="description"/>
<h2>Table of Contents</h2>
<xsl:if test="count(exports[@type='macro']) > 0">
<h3><a href="#macros">Macros</a></h3>
<pre class="api">
<xsl:apply-templates select="exports[@type='macro']" mode="toc">
<xsl:sort select='@symbol'/>
</xsl:apply-templates>
</pre>
</xsl:if>
<xsl:if test="count(exports[@type='typedef']) > 0">
<h3><a href="#types">Types</a></h3>
<pre class="api">
<xsl:apply-templates select="exports[@type='typedef']" mode="toc">
<xsl:sort select='@symbol'/>
</xsl:apply-templates>
</pre>
</xsl:if>
<xsl:if test="count(exports[@type='function']) > 0">
<h3><a href="#functions">Functions</a></h3>
<pre class="api">
<xsl:apply-templates select="exports[@type='function']" mode="toc">
<xsl:sort select='@symbol'/>
</xsl:apply-templates>
</pre>
</xsl:if>
<div class="document">
<h1><xsl:value-of select="$title"/></h1>
<xsl:call-template name="description"/>
<h2>Table of Contents</h2>
<xsl:if test="count(exports[@type='macro']) > 0">
<h3><a href="#macros">Macros</a></h3>
<pre class="api">
<xsl:apply-templates select="exports[@type='macro']" mode="toc">
<xsl:sort select='@symbol'/>
</xsl:apply-templates>
</pre>
</xsl:if>
<xsl:if test="count(exports[@type='typedef']) > 0">
<h3><a href="#types">Types</a></h3>
<pre class="api">
<xsl:apply-templates select="exports[@type='typedef']" mode="toc">
<xsl:sort select='@symbol'/>
</xsl:apply-templates>
</pre>
</xsl:if>
<xsl:if test="count(exports[@type='function']) > 0">
<h3><a href="#functions">Functions</a></h3>
<pre class="api">
<xsl:apply-templates select="exports[@type='function']" mode="toc">
<xsl:sort select='@symbol'/>
</xsl:apply-templates>
</pre>
</xsl:if>
<h2>Description</h2>
<h2>Description</h2>
<xsl:if test="count(exports[@type='macro']) > 0">
<h3><a id="macros">Macros</a></h3>
<xsl:apply-templates select="exports[@type='macro']">
<xsl:sort select='@symbol'/>
</xsl:apply-templates>
</xsl:if>
<xsl:if test="count(exports[@type='typedef']) > 0">
<h3><a id="types">Types</a></h3>
<xsl:apply-templates select="exports[@type='typedef']">
<xsl:sort select='@symbol'/>
</xsl:apply-templates>
</xsl:if>
<xsl:if test="count(exports[@type='function']) > 0">
<h3><a id="functions">Functions</a></h3>
<xsl:apply-templates select="exports[@type='function']">
<xsl:sort select='@symbol'/>
</xsl:apply-templates>
</xsl:if>
<xsl:if test="count(exports[@type='macro']) > 0">
<h3><a id="macros">Macros</a></h3>
<xsl:apply-templates select="exports[@type='macro']">
<xsl:sort select='@symbol'/>
</xsl:apply-templates>
</xsl:if>
<xsl:if test="count(exports[@type='typedef']) > 0">
<h3><a id="types">Types</a></h3>
<xsl:apply-templates select="exports[@type='typedef']">
<xsl:sort select='@symbol'/>
</xsl:apply-templates>
</xsl:if>
<xsl:if test="count(exports[@type='function']) > 0">
<h3><a id="functions">Functions</a></h3>
<xsl:apply-templates select="exports[@type='function']">
<xsl:sort select='@symbol'/>
</xsl:apply-templates>
</xsl:if>
</div>
</body>
</html>
</xsl:template>

View File

@ -73,17 +73,6 @@
<xsl:when test="html:html/html:body/html:main">
<xsl:apply-templates select="/html:html/html:body/*" mode="content"/>
</xsl:when>
<!-- for our older html-only files -->
<xsl:otherwise>
<div class="document">
<xsl:if test="html:html/html:body/@id">
<xsl:attribute name="id">
<xsl:value-of select="html:html/html:body/@id"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates select="/html:html/html:body/*" mode="content"/>
</div>
</xsl:otherwise>
</xsl:choose>
</div>
<div id="nav">

View File

@ -450,7 +450,8 @@ for drv in list(drivers.keys()):
print('''<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<body id="hvsupport">
<body>
<div id="hvsupport" class="document">
<h1>libvirt API support matrix</h1>
<nav class="contents" id="contents">
@ -536,4 +537,4 @@ for grp in sorted(groups.keys()):
print("</tbody>\n</table>")
print("</body>\n</html>")
print("</div>\n</body>\n</html>")