]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
docs: xsl: Simplify templating XSL
authorPeter Krempa <pkrempa@redhat.com>
Wed, 17 May 2023 12:17:56 +0000 (14:17 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 18 May 2023 08:06:51 +0000 (10:06 +0200)
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>
docs/newapi.xsl
docs/page.xsl
scripts/hvsupport.py

index cc683707cfed019fd00e0dbfa1baa61c0bb4e37f..a8797f800da36293ad074bfd3e5ef809c8876456 100644 (file)
 </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">
+        <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>
+
+          <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>
-          </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: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>
-          </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: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>
-          </pre>
-        </xsl:if>
-
-        <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>
+        </div>
       </body>
     </html>
   </xsl:template>
index a93f24fb091813e39fbd197250ff04d45ac76ed9..c92ceffec78f39d2df4552045a2620eadbd512d2 100644 (file)
             <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">
index df1122e123d182f99a586ac1d564189aed4d6249..be6bf7b0d2d9f879c3d649f178e8001ae1ef3cbd 100755 (executable)
@@ -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>")