docs: xsl: Don't format empty sections in API manual

The LXC module has no exported 'Types' but the XSL template which
generates the 'libvirt-libvirt-lxc.html' page would try to format it
anyways. This would result in an empty non-pair version of the '<pre>'
tag to be used in the page, which didn't render well with modern
browsers for some reason. All following sections would become children
of the non-pair <pre>.

Fix the XSL template to not generate empty 'Types' or 'Functions'
sections similarly to how we do with 'Macros'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2022-11-03 10:45:56 +01:00
parent 0097f2a36e
commit ed2109d272

View File

@ -756,18 +756,22 @@
</xsl:apply-templates>
</pre>
</xsl:if>
<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>
<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 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>
@ -777,14 +781,18 @@
<xsl:sort select='@symbol'/>
</xsl:apply-templates>
</xsl:if>
<h3><a id="types">Types</a></h3>
<xsl:apply-templates select="exports[@type='typedef']">
<xsl:sort select='@symbol'/>
</xsl:apply-templates>
<h3><a id="functions">Functions</a></h3>
<xsl:apply-templates select="exports[@type='function']">
<xsl:sort select='@symbol'/>
</xsl:apply-templates>
<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>
</body>
</html>
</xsl:template>