1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

docs: xsl: Unify stylability of main container element

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>
This commit is contained in:
Peter Krempa 2020-11-04 16:27:32 +01:00
parent 5f0d7fc636
commit 9fd2e78b96
5 changed files with 24 additions and 17 deletions

View 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>

View File

@ -8,7 +8,7 @@
// -->
</script>
</head>
<body class="index">
<body id="index">
<h1>The virtualization API</h1>
<div class="panel">

View File

@ -95,7 +95,7 @@
margin-right: 1em;
}
#content {
.document {
margin-left: auto;
margin-right: auto;
padding: 0px;
@ -104,9 +104,9 @@
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;
}

View File

@ -112,15 +112,22 @@
</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">

View File

@ -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>