Skip to contentSkip to conversation

sphinx: qapidoc: Wrap "If" section body in a paragraph node

PATCH In review John Snow 3 participants 6 messages Apr 6, 2021 – Apr 13, 2021

lore
Share & tools
lore

John Snow

author
#0 lore raw

cover sphinx: qapidoc: Wrap "If" section body in a paragraph node

(See commit message.)

John Snow (1):
sphinx: qapidoc: Wrap "If" section body in a paragraph node

 docs/sphinx/qapidoc.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Signature · 1 line
2.30.2
author
#1 lore raw

PATCH 1/1 sphinx: qapidoc: Wrap "If" section body in a paragraph node

These sections need to be wrapped in a block-level element, such as Paragraph in order for them to be rendered into Texinfo correctly.

Before (e.g.):

<section ids="qapidoc-713">
<title>If</title>
<literal>defined(CONFIG_REPLICATION)</literal>
</section>

became:

.SS If
\fBdefined(CONFIG_REPLICATION)\fP.SS \fBBlockdevOptionsReplication\fP (Object)
...

After:

<section ids="qapidoc-713">
<title>If</title>
<paragraph>
<literal>defined(CONFIG_REPLICATION)</literal>
</paragraph>
</section>

becomes:

.SS If
.sp
\fBdefined(CONFIG_REPLICATION)\fP
.SS \fBBlockdevOptionsReplication\fP (Object)
...

---
 docs/sphinx/qapidoc.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
docs/sphinx/qapidoc.py +3 -1
index b7b86b5dff..b7a2d39c10 100644
@@ -278,7 +278,9 @@ def _nodes_for_if_section(self, ifcond):
         nodelist = []
         if ifcond:
             snode = self._make_section('If')
-            snode += self._nodes_for_ifcond(ifcond, with_if=False)
+            snode += nodes.paragraph(
+                '', '', *self._nodes_for_ifcond(ifcond, with_if=False)
+            )
             nodelist.append(snode)
         return nodelist
 
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#2 lore raw
Quoted 36 lines · John Snow

These sections need to be wrapped in a block-level element, such as Paragraph in order for them to be rendered into Texinfo correctly.

Before (e.g.):

<section ids="qapidoc-713">
<title>If</title>
<literal>defined(CONFIG_REPLICATION)</literal>
</section>

became:

.SS If
\fBdefined(CONFIG_REPLICATION)\fP.SS \fBBlockdevOptionsReplication\fP (Object)
...

After:

<section ids="qapidoc-713">
<title>If</title>
<paragraph>
<literal>defined(CONFIG_REPLICATION)</literal>
</paragraph>
</section>

becomes:

.SS If
.sp
\fBdefined(CONFIG_REPLICATION)\fP
.SS \fBBlockdevOptionsReplication\fP (Object)
...

Quoted 3 lines

It's a shame Sphinx doesn't diagnose this kind of mis-constructed document tree.

thanks
-- PMM

#3 lore raw
In reply to John Snow
Quoted 2 lines · John Snow

These sections need to be wrapped in a block-level element, such as Paragraph in order for them to be rendered into Texinfo correctly.

Into man, not into Texinfo.

[...]

#5 lore raw
Quoted 4 lines · Markus Armbruster

Peter, do you intend to merge this yourself? I have nothing else queued right now. If you want me to do a pull request for this patch, let me know.

I missed this email earlier. I had assumed somebody else would pick it up, but as it happens I have a couple of last minute patches I want to send out anyway, so I'll pick this up now.

thanks
-- PMM