Skip to contentSkip to conversation

qapi2texi: replace quotation by bold section name

PATCH In review Marc-André Lureau 2 participants 2 messages Feb 17, 2017 – Feb 20, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qapi2texi: replace quotation by bold section name

When we build qemu-qmp-ref.txt this causes texinfo to complain several times:
"Negative repeat count does nothing at /usr/share/texinfo/Texinfo/Convert/Line.pm line 124."

It also doesn't display correctly, because the "Notes" text disappears entirely in the HTML version because it thinks there's no actual quotation text.

The text file output formatting is also not good.

To solve those problems, remove usage of @quotation, and simply use bold face for the section name.

---
 scripts/qapi2texi.py | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
scripts/qapi2texi.py +4 -6
index 83ded95c2d..c1071c62c6 100755
@@ -159,12 +159,10 @@ def texi_body(doc):
             func = texi_example
 
         if name:
-            # FIXME the indentation produced by @quotation in .txt and
-            # .html output is confusing
-            body += "\n@quotation %s\n%s\n@end quotation" % \
-                    (name, func(doc))
-        else:
-            body += func(doc)
+            # prefer @b over @strong, so txt doesn't translate it to *Foo:*
+            body += "\n\n@b{%s:}\n" % name
+
+        body += func(doc)
 
     return body
 
Signature · 1 line
2.11.0.295.gd7dffce1c.dirty
Reviewed-by on v1 1/1
#1 lore raw
Quoted 26 lines · Marc-André Lureau

When we build qemu-qmp-ref.txt this causes texinfo to complain several times:
"Negative repeat count does nothing at /usr/share/texinfo/Texinfo/Convert/Line.pm line 124."

It also doesn't display correctly, because the "Notes" text disappears entirely in the HTML version because it thinks there's no actual quotation text.

The text file output formatting is also not good.

To solve those problems, remove usage of @quotation, and simply use bold face for the section name.

---
 scripts/qapi2texi.py | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
scripts/qapi2texi.py +0 -0
index 83ded95c2d..c1071c62c6 100755
@@ -159,12 +159,10 @@ def texi_body(doc):
             func = texi_example

scripts/qapi2texi.py def texi_body(doc): · line 163

Quoted 10 lines
scripts/qapi2texi.py +2 -6
 
         if name:
-            # FIXME the indentation produced by @quotation in .txt and
-            # .html output is confusing
-            body += "\n@quotation %s\n%s\n@end quotation" % \
-                    (name, func(doc))
-        else:
-            body += func(doc)
+            # prefer @b over @strong, so txt doesn't translate it to *Foo:*
+            body += "\n\n@b{%s:}\n" % name

The second newline is sometimes needed to make a paragraph, and at other times it's redundant and somewhat ugly. Tolerable, as this file isn't for humans.

scripts/qapi2texi.py def texi_body(doc): · line 167

Quoted 4 lines
scripts/qapi2texi.py +2 -0
+
+        body += func(doc)
 
     return body