[PATCH 7/7] docs: xsl: Simplify templating XSL

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

 



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@xxxxxxxxxx>
---
 docs/newapi.xsl      | 86 ++++++++++++++++++++++----------------------
 docs/page.xsl        | 11 ------
 scripts/hvsupport.py |  5 +--
 3 files changed, 47 insertions(+), 55 deletions(-)

diff --git a/docs/newapi.xsl b/docs/newapi.xsl
index cc683707cf..a8797f800d 100644
--- a/docs/newapi.xsl
+++ b/docs/newapi.xsl
@@ -733,54 +733,56 @@
 </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>
diff --git a/docs/page.xsl b/docs/page.xsl
index a93f24fb09..c92ceffec7 100644
--- a/docs/page.xsl
+++ b/docs/page.xsl
@@ -73,17 +73,6 @@
             <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">
diff --git a/scripts/hvsupport.py b/scripts/hvsupport.py
index df1122e123..be6bf7b0d2 100755
--- a/scripts/hvsupport.py
+++ b/scripts/hvsupport.py
@@ -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>")
-- 
2.40.1




[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