From 58a04dd7825609a83b728b125b6879f9de3fc173 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 10 Jan 2022 20:30:00 +0100 Subject: [PATCH] documentation/doxygen: drop STUPID ‍ in
. What the hell, such a pile of unnecessary work. FFS. --- documentation/doxygen.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/documentation/doxygen.py b/documentation/doxygen.py index f65394b7..afc8ccaa 100755 --- a/documentation/doxygen.py +++ b/documentation/doxygen.py @@ -427,7 +427,24 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET. out.deprecated = parsed.deprecated i: ET.Element + # The index gets only used in code vs inline detection, to + # check if there are any elements in the block element after it. All uses + # of it need to take into account the skipping in Doxygen 1.9 + # blockquotes below. for index, i in enumerate(element): + # As of 1.9.3 and https://github.com/doxygen/doxygen/pull/7422, a + # stupid ‍ is added at the front of every Markdown blockquote for + # some silly reason, and then the Markdown is processed as a HTML, + # resulting in
. Drop the from there, as + # it's useless and messes up with our patching logic. + if index == 0 and i.tag == 'zwj' and element.tag == 'para' and immediate_parent and immediate_parent.tag == 'blockquote': + if i.tail: + tail: str = html.escape(i.tail) + if trim: + tail = tail.strip() + out.parsed += tail + continue + # State used later code_block = None formula_block = None @@ -450,7 +467,16 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET. # is autodetected to be either block or inline elif i.tag == 'programlisting': - element_children_count = len([listing for listing in element]) + # In a blockquote we need to not count the initial added by + # Doxygen 1.9. Otherwise all code blocks alone in a blockquote + # would be treated as inline. + if element.tag == 'para' and immediate_parent and immediate_parent.tag == 'blockquote': + element_children_count = 0 + for listing_index, listing in enumerate(element): + if listing_index == 0 and listing.tag == 'zwj': continue + element_children_count += 1 + else: + element_children_count = len([listing for listing in element]) # If it seems to be a standalone code paragraph, don't wrap it # in

and use

:
-- 
2.30.2