]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
docs: xsl: Unify stylability of main container element
authorPeter Krempa <pkrempa@redhat.com>
Wed, 4 Nov 2020 15:27:32 +0000 (16:27 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 16 Nov 2020 13:04:04 +0000 (14:04 +0100)
page.xsl was adding '<div id="content">' wrapper for the content picked
up from the <body> element from the original input file. Optionally
class="$DOCNAME" was added for some documents taken from <body>.

Since docs generated from RST by docutils have a '<div class='document'
id='$DOCNAME>' we actually don't need an extra wrapper for them.

Additionally if we standardize on one of them we can use the same styles
for both. I've picked the latter because it makes more sense to use the
document name as 'id'.

This patch:
1) Modifies the XSL trasformation to add the wrapper only if it's not
   present.

2) Modifies the XSL transformation to use 'id' for document name and
   class='document' for the wrapper element.

3) Changes docs.html/index.html/hvsupport.html to use 'id' instead of
   'class' for document name.

4) Modifies the main stylesheet to keep styling the elements properly

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
docs/docs.html.in
docs/index.html.in
docs/libvirt.css
docs/page.xsl
scripts/hvsupport.py

index 77d5c78b3022a33f1bf45a1c6e66760f978ca28c..22a43517ed7aaa2abca5938c46a9e98bb28593b6 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE html>
 <html xmlns="http://www.w3.org/1999/xhtml">
-  <body class="docs">
+  <body id="docs">
     <h1>Documentation</h1>
     <div class="panel">
       <h2>Deployment / operation</h2>
index 3057a052dd8daea926c5e34419ecd741cab4916c..df182c27b6f8f4b629bd160dba9f975df347e665 100644 (file)
@@ -8,7 +8,7 @@
       // -->
     </script>
   </head>
-  <body class="index">
+  <body id="index">
     <h1>The virtualization API</h1>
 
     <div class="panel">
index 1511ccf9e9d8ab9ecc36f2280478a5145ff46d48..bb71244a7ebd8774f3dc7b9d02fe619dd75fa842 100644 (file)
@@ -95,7 +95,7 @@
     margin-right: 1em;
 }
 
-#content {
+.document {
     margin-left: auto;
     margin-right: auto;
     padding: 0px;
     width: 70em;
 }
 
-body.index #content,
-body.docs #content,
-body.hvsupport #content
+#index.document,
+#docs.document,
+#hvsupport.document
 {
     width: inherit;
 }
@@ -412,14 +412,14 @@ div.panel h2 {
     text-align: center;
 }
 
-body.index h1 {
+#index.document h1 {
     border: 0px;
     text-indent: 100%; white-space: nowrap; overflow: hidden;
     background: url(logos/logo-banner-dark-800.png) no-repeat center center;
     height: 300px;
 }
 
-body.docs h1 {
+#docs.document h1 {
     visibility: hidden;
 }
 
index 9e0d4e0954d863750691579ba3573de72a06f7ae..5cb4322fdcb210a180d7eeb3c324689d9aba5f46 100644 (file)
         </script>
       </head>
       <body onload="pageload()">
-        <xsl:if test="html:html/html:body/@class">
-          <xsl:attribute name="class">
-            <xsl:value-of select="html:html/html:body/@class"/>
-          </xsl:attribute>
-        </xsl:if>
         <div id="body">
-          <div id="content">
-            <xsl:apply-templates select="/html:html/html:body/*" mode="content"/>
-          </div>
+          <xsl:choose>
+            <xsl:when test="html:html/html:body/html:div/@class='document'">
+              <xsl:apply-templates select="/html:html/html:body/*" mode="content"/>
+            </xsl:when>
+            <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">
           <div id="home">
index e2aab8feffec23e0e53a1f2be45623ee667bbe73..50ba25c78faebec14ae9e642ff115f4c1db0c4c9 100755 (executable)
@@ -420,7 +420,7 @@ for drv in drivers.keys():
 print('''<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE html>
 <html xmlns="http://www.w3.org/1999/xhtml">
-<body class="hvsupport">
+<body id="hvsupport">
 <h1>libvirt API support matrix</h1>
 
 <ul id="toc"></ul>