[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 03/32] qapi2texi: Fix for examples containing '@
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [RFC PATCH 03/32] qapi2texi: Fix for examples containing '@' |
Date: |
Mon, 2 Oct 2017 17:25:23 +0200 |
Instead of quoting example text so that the @example environment shows
it verbatim, simply use the @verbatim environment.
Examples are no longer indented in output, because makeinfo doesn't
indent @verbatim, unlike @example.
TODO keep indentation somehow?
Signed-off-by: Markus Armbruster <address@hidden>
---
scripts/qapi2texi.py | 12 +++++-------
tests/qapi-schema/doc-good.json | 2 +-
tests/qapi-schema/doc-good.out | 2 +-
tests/qapi-schema/doc-good.texi | 16 ++++++++--------
4 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/scripts/qapi2texi.py b/scripts/qapi2texi.py
index 92e2af2cd6..1500afc553 100755
--- a/scripts/qapi2texi.py
+++ b/scripts/qapi2texi.py
@@ -52,13 +52,11 @@ def subst_braces(doc):
def texi_example(doc):
- """Format @example"""
- # TODO: Neglects to escape @ characters.
- # We should probably escape them in subst_braces(), and rename the
- # function to subst_special() or subs_texi_special(). If we do that, we
- # need to delay it until after subst_vars() in texi_format().
- doc = subst_braces(doc).strip('\n')
- return EXAMPLE_FMT(code=doc)
+ """Format example text"""
+ return """@verbatim
+{code}
address@hidden verbatim
+""".format(code=doc.strip('\n'))
def texi_format(doc):
diff --git a/tests/qapi-schema/doc-good.json b/tests/qapi-schema/doc-good.json
index 44098d7f1a..54a0012d5f 100644
--- a/tests/qapi-schema/doc-good.json
+++ b/tests/qapi-schema/doc-good.json
@@ -117,7 +117,7 @@
# <- out
# Examples:
# - *verbatim*
-# - @at sign BUG: gets passed to Texinfo unescaped
+# - @at sign
# - {braces}
# Since: 2.10
##
diff --git a/tests/qapi-schema/doc-good.out b/tests/qapi-schema/doc-good.out
index b732b81119..a62d2d879c 100644
--- a/tests/qapi-schema/doc-good.out
+++ b/tests/qapi-schema/doc-good.out
@@ -138,7 +138,7 @@ Duis aute irure dolor
<- out
section=Examples
- *verbatim*
-- @at sign BUG: gets passed to Texinfo unescaped
+- @at sign
- {braces}
section=Since
2.10
diff --git a/tests/qapi-schema/doc-good.texi b/tests/qapi-schema/doc-good.texi
index 840a492249..3b77f2f675 100644
--- a/tests/qapi-schema/doc-good.texi
+++ b/tests/qapi-schema/doc-good.texi
@@ -201,17 +201,17 @@ Ut enim ad minim veniam
Duis aute irure dolor
@b{Example:}
address@hidden
address@hidden
-> in
<- out
address@hidden example
address@hidden verbatim
@b{Examples:}
address@hidden
address@hidden
- *verbatim*
-- @at sign BUG: gets passed to Texinfo unescaped
-- @address@hidden
address@hidden example
+- @at sign
+- {braces}
address@hidden verbatim
@b{Since:}
2.10
@@ -227,11 +227,11 @@ If you're bored enough to read this, go see a video of
boxed cats
@b{Arguments:} the members of @code{Object}
@b{Example:}
address@hidden
address@hidden
-> in
<- out
address@hidden example
address@hidden verbatim
@end deftypefn
--
2.13.6
- Re: [Qemu-devel] [RFC PATCH 12/32] qapi: Use argparse to parse command line arguments, (continued)
- [Qemu-devel] [RFC PATCH 17/32] qapi: Fix simple union lowering with multiple schemas, Markus Armbruster, 2017/10/02
- [Qemu-devel] [RFC PATCH 15/32] tests/qapi-schema: Improve simple union coverage, Markus Armbruster, 2017/10/02
- [Qemu-devel] [RFC PATCH 11/32] qapi: Drop the options to generate only .c or .h, Markus Armbruster, 2017/10/02
- [Qemu-devel] [RFC PATCH 07/32] qapi: Drop superfluous allow_optional=True, Markus Armbruster, 2017/10/02
- [Qemu-devel] [RFC PATCH 03/32] qapi2texi: Fix for examples containing '@',
Markus Armbruster <=
- [Qemu-devel] [RFC PATCH 26/32] qapi2texi: Include command line options information, Markus Armbruster, 2017/10/02
- [Qemu-devel] [RFC PATCH 27/32] os-posix: Drop misleading comment, Markus Armbruster, 2017/10/02
- [Qemu-devel] [RFC PATCH 14/32] qapi: Rework generated code for built-in types, Markus Armbruster, 2017/10/02
- [Qemu-devel] [RFC PATCH 28/32] vl: QAPIfy command line option definition, Markus Armbruster, 2017/10/02