diff options
author | Peter Krempa <pkrempa@redhat.com> | 2022-11-03 10:45:56 +0100 |
---|---|---|
committer | Peter Krempa <pkrempa@redhat.com> | 2022-11-03 14:11:22 +0100 |
commit | ed2109d2720af25592acb999475d510ca7c36479 (patch) | |
tree | 2c8e3a9ac6ecddc05fdb113e319c1edca5ff1433 /docs/newapi.xsl | |
parent | 0097f2a36e690f18bbc8bc347b76d9645cee2106 (diff) | |
download | libvirt-ed2109d2720af25592acb999475d510ca7c36479.tar.gz |
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>
Diffstat (limited to 'docs/newapi.xsl')
-rw-r--r-- | docs/newapi.xsl | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/docs/newapi.xsl b/docs/newapi.xsl index d48b1fbecd..7b0085930f 100644 --- a/docs/newapi.xsl +++ b/docs/newapi.xsl @@ -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> |