[PATCH 5/9] docs: newapi: Don't generate empty <div> in template for ACL permissions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 docs/newapi.xsl | 60 +++++++++++++++++++++++++------------------------
 1 file changed, 31 insertions(+), 29 deletions(-)

diff --git a/docs/newapi.xsl b/docs/newapi.xsl
index 38cefb2ca8..b60680ae97 100644
--- a/docs/newapi.xsl
+++ b/docs/newapi.xsl
@@ -26,30 +26,34 @@
   <xsl:template name="aclinfo">
     <xsl:param name="acl"/>

-    <xsl:if test="count($acl/check) > 0">
-      <h5>Access control parameter checks</h5>
-      <table>
-        <thead>
-          <tr>
-            <th>Object</th>
-            <th>Permission</th>
-            <th>Condition</th>
-          </tr>
-        </thead>
-        <xsl:apply-templates select="$acl/check" mode="acl"/>
-      </table>
-    </xsl:if>
-    <xsl:if test="count($acl/filter) > 0">
-      <h5>Access control return value filters</h5>
-      <table>
-        <thead>
-          <tr>
-            <th>Object</th>
-            <th>Permission</th>
-          </tr>
-        </thead>
-        <xsl:apply-templates select="$acl/filter" mode="acl"/>
-      </table>
+    <xsl:if test="count($acl/check) > 0 or count($acl/filter) > 0">
+      <div class="acl">
+        <xsl:if test="count($acl/check) > 0">
+          <h5>Access control parameter checks</h5>
+          <table>
+            <thead>
+              <tr>
+                <th>Object</th>
+                <th>Permission</th>
+                <th>Condition</th>
+              </tr>
+            </thead>
+            <xsl:apply-templates select="$acl/check" mode="acl"/>
+          </table>
+        </xsl:if>
+        <xsl:if test="count($acl/filter) > 0">
+          <h5>Access control return value filters</h5>
+          <table>
+            <thead>
+              <tr>
+                <th>Object</th>
+                <th>Permission</th>
+              </tr>
+            </thead>
+            <xsl:apply-templates select="$acl/filter" mode="acl"/>
+          </table>
+        </xsl:if>
+      </div>
     </xsl:if>
   </xsl:template>

@@ -702,11 +706,9 @@
         </xsl:if>
       </dl>
     </xsl:if>
-    <div class="acl">
-      <xsl:call-template name="aclinfo">
-        <xsl:with-param name="acl" select="acls"/>
-      </xsl:call-template>
-    </div>
+    <xsl:call-template name="aclinfo">
+      <xsl:with-param name="acl" select="acls"/>
+    </xsl:call-template>
   </xsl:template>

   <xsl:template match="exports" mode="toc">
-- 
2.43.0
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux