[PATCH 0/2] docs: Adapt XSL/CSS to docutils-0.17 and later

The breakage will be visible only when you build with newer docutils such as is in fedora rawhide. Alternatively you can install one locally for your user via 'pip install docutils --force' and then build the tree via: export PYTHONPATH=~/.local/lib/python3.10/site-packages/ ninja Peter Krempa (2): docs/css: Simplify selector for heading of 'knowledge-base' and 'documentation' pages docs: Adapt to semantic tag usage of docutils-0.17 and later docs/css/libvirt.css | 13 +++++++++++-- docs/page.xsl | 6 ++++++ 2 files changed, 17 insertions(+), 2 deletions(-) -- 2.35.1

Select direct 'h1' children of elements named 'knowledge-base' and 'documentation. It's simpler and will also work properly with docutils-0.17 and later where we don't have a div with class 'document' wrapping everything. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- docs/css/libvirt.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/css/libvirt.css b/docs/css/libvirt.css index 2ae80f8595..2b2208f56e 100644 --- a/docs/css/libvirt.css +++ b/docs/css/libvirt.css @@ -425,8 +425,8 @@ div.panel h2, height: 300px; } -#documentation.document > h1, -#knowledge-base.document > h1 { +#documentation > h1, +#knowledge-base > h1 { text-align: center; padding: 1em; } -- 2.35.1

Docutils-0.17 switched to using <main> instead of a <div class='document'> and <section> instead of <div class='section'>. To ensure that our pages still work we need to slightly adapt our XSL stylesheet to select the <main> tag properly and adapt the CSS to also select the 'section' element instead of a class and to apply to a <main> tag with the appropriate names. Docutils-0.17 also changed to use 'h2' for section heading instead of 'h1'. Note the styles applied to the 'main' element with certain id can't be made more universal by just applying to the id itself, as in certain cases (e.g. 'documentation') we also have sections with that name. This was previously ensured by also matching the 'document' class which would make it equal to the 'main' element. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- docs/css/libvirt.css | 9 +++++++++ docs/page.xsl | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/docs/css/libvirt.css b/docs/css/libvirt.css index 2b2208f56e..097dfcbe8e 100644 --- a/docs/css/libvirt.css +++ b/docs/css/libvirt.css @@ -95,6 +95,7 @@ margin-right: 1em; } +main, .document { margin-left: auto; margin-right: auto; @@ -104,9 +105,13 @@ width: 70em; } +main#index, #index.document, +main#hvsupport, #hvsupport.document, +main#documentation, #documentation.document, +main#knowledge-base, #knowledge-base.document { width: inherit; @@ -397,7 +402,9 @@ h6:hover > a.headerlink { } div.panel, +#documentation section, #documentation .section, +#knowledge-base section, #knowledge-base .section { width: 24%; @@ -407,7 +414,9 @@ div.panel, } div.panel h2, +#documentation section h2, #documentation .section h1, +#knowledge-base section h2, #knowledge-base .section h1 { margin-top: 0px; padding: 0.5em; diff --git a/docs/page.xsl b/docs/page.xsl index a6a270896c..7d0203cf62 100644 --- a/docs/page.xsl +++ b/docs/page.xsl @@ -120,9 +120,15 @@ <body onload="pageload()"> <div id="body"> <xsl:choose> + <!-- docutils-0.16 and older use a div as container for contents --> <xsl:when test="html:html/html:body/html:div/@class='document'"> <xsl:apply-templates select="/html:html/html:body/*" mode="content"/> </xsl:when> + <!-- docutils-0.17 adopted use of the 'main' semantic container --> + <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"> -- 2.35.1

On a Tuesday in 2022, Peter Krempa wrote:
The breakage will be visible only when you build with newer docutils such as is in fedora rawhide.
d/is /
Alternatively you can install one locally for your user via 'pip install docutils --force' and then build the tree via:
export PYTHONPATH=~/.local/lib/python3.10/site-packages/ ninja
Peter Krempa (2): docs/css: Simplify selector for heading of 'knowledge-base' and 'documentation' pages docs: Adapt to semantic tag usage of docutils-0.17 and later
docs/css/libvirt.css | 13 +++++++++++-- docs/page.xsl | 6 ++++++ 2 files changed, 17 insertions(+), 2 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

On 4/12/22 13:53, Peter Krempa wrote:
The breakage will be visible only when you build with newer docutils such as is in fedora rawhide.
Alternatively you can install one locally for your user via 'pip install docutils --force' and then build the tree via:
export PYTHONPATH=~/.local/lib/python3.10/site-packages/ ninja
Peter Krempa (2): docs/css: Simplify selector for heading of 'knowledge-base' and 'documentation' pages docs: Adapt to semantic tag usage of docutils-0.17 and later
docs/css/libvirt.css | 13 +++++++++++-- docs/page.xsl | 6 ++++++ 2 files changed, 17 insertions(+), 2 deletions(-)
Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Michal

On Tue, Apr 12, 2022 at 13:53:03 +0200, Peter Krempa wrote:
The breakage will be visible only when you build with newer docutils such as is in fedora rawhide.
Alternatively you can install one locally for your user via 'pip install docutils --force' and then build the tree via:
export PYTHONPATH=~/.local/lib/python3.10/site-packages/ ninja
Peter Krempa (2): docs/css: Simplify selector for heading of 'knowledge-base' and 'documentation' pages docs: Adapt to semantic tag usage of docutils-0.17 and later
docs/css/libvirt.css | 13 +++++++++++-- docs/page.xsl | 6 ++++++ 2 files changed, 17 insertions(+), 2 deletions(-)
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>

On Tue, Apr 12, 2022 at 01:53:03PM +0200, Peter Krempa wrote:
The breakage will be visible only when you build with newer docutils such as is in fedora rawhide.
Alternatively you can install one locally for your user via 'pip install docutils --force' and then build the tree via:
export PYTHONPATH=~/.local/lib/python3.10/site-packages/ ninja
Peter Krempa (2): docs/css: Simplify selector for heading of 'knowledge-base' and 'documentation' pages docs: Adapt to semantic tag usage of docutils-0.17 and later
docs/css/libvirt.css | 13 +++++++++++-- docs/page.xsl | 6 ++++++ 2 files changed, 17 insertions(+), 2 deletions(-)
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
-- 2.35.1
participants (5)
-
Jiri Denemark
-
Ján Tomko
-
Martin Kletzander
-
Michal Prívozník
-
Peter Krempa