From 7581ea0e75ab9160cfe58acfc9d874ad1ce6d703 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 10 Jan 2022 20:02:37 +0100 Subject: [PATCH] documentation/doxygen: fix Doxygen 1.9 code-after-blockquote bugs. Before it was wrapped in a dedicated paragraph, now it's not anymore. Thus, if a is right after a
and there's nothing else after it until the end of , it should be treated as a code block again. --- documentation/doxygen.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/documentation/doxygen.py b/documentation/doxygen.py index d293940e..f65394b7 100755 --- a/documentation/doxygen.py +++ b/documentation/doxygen.py @@ -395,6 +395,10 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET. # kind), set only if there is no i.tail, reset in the next iteration. previous_section = None + # So we can peek what the previous element was. Needed by Doxygen 1.9 + # code-after-blockquote discovery. + previous_element = None + # A CSS class to be added inline (not propagated outside of the paragraph) add_inline_css_class = None @@ -461,13 +465,16 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET. # so for @include and related, though.) ('filename' in i.attrib and not i.attrib['filename'].startswith('.')) or - # or is code right after a note/attention/... section, + # or is + # - code right after a note/attention/... section + # - or in Doxygen 1.9 code right after a blockquote, which is + # no longer wrapped into its own , # there's no text after and it's the last thing in the # paragraph (Doxygen ALSO doesn't separate end of a section # and begin of a code block by a paragraph even if there is # a blank line. But it does so for xrefitems such as @todo. # I don't even.) - (previous_section and (not i.tail or not i.tail.strip()) and index + 1 == element_children_count) + ((previous_section or (previous_element and previous_element.tag == 'blockquote')) and (not i.tail or not i.tail.strip()) and index + 1 == element_children_count) ): code_block = True @@ -1664,6 +1671,10 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET. tail = tail.lstrip() out.parsed += tail + # Remember the previous element. Needed by Doxygen 1.9 + # code-after-blockquote discovery. + previous_element = i + # A section was left open in the last iteration, close it. Expect that # there was nothing after that would mess with us. if previous_section: -- 2.30.2