docs: newapi: Don't generate empty <div> in template for ACL permissions

If an API has no ACLs an empty <div class='acl'/> would be generated
which is mis-interpreted by browsers when creating DOM to nest any
subsequent elements under it.

Don't generate the ACL section div unless it will be filled.

Best viewed with 'git show -w'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Peter Krempa 2024-02-22 13:29:07 +01:00
parent bf4a709ebe
commit 3a0af92df6

View File

@ -26,30 +26,34 @@
<xsl:template name="aclinfo"> <xsl:template name="aclinfo">
<xsl:param name="acl"/> <xsl:param name="acl"/>
<xsl:if test="count($acl/check) > 0"> <xsl:if test="count($acl/check) > 0 or count($acl/filter) > 0">
<h5>Access control parameter checks</h5> <div class="acl">
<table> <xsl:if test="count($acl/check) > 0">
<thead> <h5>Access control parameter checks</h5>
<tr> <table>
<th>Object</th> <thead>
<th>Permission</th> <tr>
<th>Condition</th> <th>Object</th>
</tr> <th>Permission</th>
</thead> <th>Condition</th>
<xsl:apply-templates select="$acl/check" mode="acl"/> </tr>
</table> </thead>
</xsl:if> <xsl:apply-templates select="$acl/check" mode="acl"/>
<xsl:if test="count($acl/filter) > 0"> </table>
<h5>Access control return value filters</h5> </xsl:if>
<table> <xsl:if test="count($acl/filter) > 0">
<thead> <h5>Access control return value filters</h5>
<tr> <table>
<th>Object</th> <thead>
<th>Permission</th> <tr>
</tr> <th>Object</th>
</thead> <th>Permission</th>
<xsl:apply-templates select="$acl/filter" mode="acl"/> </tr>
</table> </thead>
<xsl:apply-templates select="$acl/filter" mode="acl"/>
</table>
</xsl:if>
</div>
</xsl:if> </xsl:if>
</xsl:template> </xsl:template>
@ -702,11 +706,9 @@
</xsl:if> </xsl:if>
</dl> </dl>
</xsl:if> </xsl:if>
<div class="acl"> <xsl:call-template name="aclinfo">
<xsl:call-template name="aclinfo"> <xsl:with-param name="acl" select="acls"/>
<xsl:with-param name="acl" select="acls"/> </xsl:call-template>
</xsl:call-template>
</div>
</xsl:template> </xsl:template>
<xsl:template match="exports" mode="toc"> <xsl:template match="exports" mode="toc">