mirror of https://github.com/xemu-project/xemu.git
qapi/parser: don't parse rST markup as section headers
The double-colon synax is rST formatting that precedes a literal code block. We do not want to capture these as QAPI-specific sections. Coerce blocks that start with e.g. "Example::" to be parsed as untagged paragraphs instead of special tagged sections. Signed-off-by: John Snow <jsnow@redhat.com> Message-ID: <20240626222128.406106-14-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Indentation tweaked for consistency] Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
543ff13a20
commit
65fa48c79f
|
@ -544,10 +544,15 @@ class QAPISchemaParser:
|
||||||
line = self.get_doc_indented(doc)
|
line = self.get_doc_indented(doc)
|
||||||
no_more_args = True
|
no_more_args = True
|
||||||
elif match := re.match(
|
elif match := re.match(
|
||||||
r'(Returns|Errors|Since|Notes?|Examples?|TODO): *',
|
r'(Returns|Errors|Since|Notes?|Examples?|TODO)'
|
||||||
line):
|
r'(?!::): *',
|
||||||
|
line,
|
||||||
|
):
|
||||||
# tagged section
|
# tagged section
|
||||||
|
|
||||||
|
# Note: "sections" with two colons are left alone as
|
||||||
|
# rST markup and not interpreted as a section heading.
|
||||||
|
|
||||||
# TODO: Remove this error sometime in 2025 or so
|
# TODO: Remove this error sometime in 2025 or so
|
||||||
# after we've fully transitioned to the new qapidoc
|
# after we've fully transitioned to the new qapidoc
|
||||||
# generator.
|
# generator.
|
||||||
|
|
|
@ -181,6 +181,9 @@
|
||||||
# - *verbatim*
|
# - *verbatim*
|
||||||
# - {braces}
|
# - {braces}
|
||||||
#
|
#
|
||||||
|
# Note::
|
||||||
|
# Ceci n'est pas une note
|
||||||
|
#
|
||||||
# Since: 2.10
|
# Since: 2.10
|
||||||
##
|
##
|
||||||
{ 'command': 'cmd',
|
{ 'command': 'cmd',
|
||||||
|
|
|
@ -190,6 +190,9 @@ frobnicate
|
||||||
section=Examples
|
section=Examples
|
||||||
- *verbatim*
|
- *verbatim*
|
||||||
- {braces}
|
- {braces}
|
||||||
|
section=None
|
||||||
|
Note::
|
||||||
|
Ceci n'est pas une note
|
||||||
section=Since
|
section=Since
|
||||||
2.10
|
2.10
|
||||||
doc symbol=cmd-boxed
|
doc symbol=cmd-boxed
|
||||||
|
|
|
@ -231,6 +231,9 @@ Examples
|
||||||
- *verbatim*
|
- *verbatim*
|
||||||
- {braces}
|
- {braces}
|
||||||
|
|
||||||
|
Note::
|
||||||
|
Ceci n'est pas une note
|
||||||
|
|
||||||
|
|
||||||
Since
|
Since
|
||||||
~~~~~
|
~~~~~
|
||||||
|
|
Loading…
Reference in New Issue