Skip to content

Add SUSE metadata to the sphinx build#2968

Draft
schaefi wants to merge 3 commits intomainfrom
suse_doc_metadata
Draft

Add SUSE metadata to the sphinx build#2968
schaefi wants to merge 3 commits intomainfrom
suse_doc_metadata

Conversation

@schaefi
Copy link
Collaborator

@schaefi schaefi commented Mar 10, 2026

To support further features on the SUSE documentation an additional metadata block needs to be added to the XML representation of the sphinx documentation build use by the make docs_suse target.

@schaefi schaefi requested a review from tomschr March 10, 2026 18:07
@schaefi schaefi self-assigned this Mar 10, 2026
@schaefi
Copy link
Collaborator Author

schaefi commented Mar 10, 2026

@tomschr This change already breaks the docbook results. Please rebuild and check yourself via

make docs_suse

from the kiwi git checkout

Thanks

Copy link
Collaborator

@tomschr tomschr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 👍 I have only one minor comment, see below.

Just for references, when you apply the metadata, Sphinx creates this structure:

<field_list>
   <field>
     <field_name>meta</field_name>
     <field_body>
        <field_list>
           <field>
              <field_name>description</field_name>
              <field_body>
                  <paragraph>Your flexible operating system image and appliance builder</paragraph>
              </field_body>
           </field>
        <!-- ... expect more fields, but pruned ... -->
        </field_list>
     <field_body>
   <field>
</field_list>

In rstxml2docbook, we need to create a template rule that matches the tags from above. This template rule includes the necessary DocBook 5 <meta> tags.

@schaefi schaefi force-pushed the suse_doc_metadata branch from 7568bc1 to 0e6a02a Compare March 11, 2026 10:40
To support further features on the SUSE documentation
an additional metadata block needs to be added to the
XML representation of the sphinx documentation build
use by the make docs_suse target.
@schaefi schaefi force-pushed the suse_doc_metadata branch from 0e6a02a to 9e3e937 Compare March 11, 2026 10:42
@schaefi
Copy link
Collaborator Author

schaefi commented Mar 11, 2026

@tomschr you approved this but I keep it as draft and will not merge because it breaks the build. See here

make docs_suse

...
[INFO    ] - rstxml2db.xml.process - Writing results to 'build/xml/book.xml'...
bash -c 'mkdir -p doc/build/images/src/png && \
	cp -a doc/source/.images/* doc/build/images/src/png'
cp doc/DC-kiwi doc/build/
bash -c 'pushd doc/build && daps -d DC-kiwi html'
~/kiwi/doc/build ~/kiwi
ERROR: Inappropriate root element! Allowed elements are:
       appendix article assembly bibliography book chapter glossary glossdiv part preface qandaset reference refsect1 refsect2 refsect3 refsection sect1 sect2 sect3 sect4 sect5 section set
       Found variablelist

As you can see the produced doc/build/xml/book.xml is now wrong because it resolved the new
suse_metadata.rst into something like this

<variablelist xmlns="http://docbook.org/ns/docbook" role="field_list">
   ...
</variablelist>
<?xml-model 
      href="file:/usr/share/xml/docbook/schema/rng/5.1/docbookxi.rnc"
      type="application/relax-ng-compact-syntax"
     ?>

So I believe adaptions to rstxml2docbook are required and I can't make those

@tomschr
Copy link
Collaborator

tomschr commented Mar 11, 2026

Uhh, thanks. Yes, that certainly needs adaptions in the stylesheet of rstxml2docbook. Let's see when I find some time...

@tomschr
Copy link
Collaborator

tomschr commented Mar 12, 2026

@schaefi I've had a quick look and found something interesting. We basically are faced with two issues:

  • The metadata from suse_metadata.rst.
    This should be an easy fix; it's basically adding new template rules to the stylesheet and converting the list into something useful (probably a DocBook <meta> tag).

  • An empty .. toctree output.
    This is a more severe issue. In your main entry file source/index.rst you have a table of content in line 26ff:

    .. toctree::
       :maxdepth: 1
       :hidden:
    
       overview
       [...]

    This is fine. When you run make xml_suse, Sphinx transforms this into a <compound classes="toctree-wrapper">.

    However, I get this result in build/xml/index.xml:

    <compound classes="toctree-wrapper">
    </compound>

    It's empty! This is VERY unfortunate as my script needs this information to traverse all the files. If it's empty, this traversal cannot occur. Hence this is why you get a <book> element, but without much content. Argh! 😢

I'm not actually sure why this happened. This makes my script unusable as it relies on this element. Seems Sphinx changed something. I used Sphinx 9.1.0.

Before this change, there was a whole list inside <compound>. This is gone now. 😞

Not sure how to proceed here...

@schaefi
Copy link
Collaborator Author

schaefi commented Mar 12, 2026

Not sure how to proceed here...

Thanks much for digging into this. I made a commit that should solve the toctree problem

This creates an element <document role="main"> for the master document
but not for other sub-documents.
This is necessary that the XSLT stylesheet rstxml2db.xsl from the
rstxml2docbook project finds the start.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants