From: Vladimír Vondruš Date: Wed, 13 Dec 2017 19:46:18 +0000 (+0100) Subject: doxygen: implemented section merging. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=243fcf845926be357160563c5ec9c2a6e16590f5;p=blog.git doxygen: implemented section merging. So multiple adjacent \attention, \note etc. paragraph of the same kind are now merged into one, to be consistent with HTML output. Works also with code blocks. --- diff --git a/doxygen/dox2html5.py b/doxygen/dox2html5.py index 38d4af5d..2fb3a297 100755 --- a/doxygen/dox2html5.py +++ b/doxygen/dox2html5.py @@ -165,12 +165,23 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET. paragraph_count = 0 has_block_elements = False + # So we are able to merge content of adjacent sections. Tuple of (tag, + # kind), set only if there is no i.tail, reset in the next iteration. + previous_section = None + i: ET.Element for i in element: # State used later code_block = None formula_block = None + # A section was left open, but there's nothing to continue it, close + # it. Expect that there was nothing after that would mess with us. + if previous_section and i.tag != 'simplesect': + previous_section = None + assert not out.write_paragraph_close_tag + out.parsed = out.parsed.rstrip() + '' + # DOXYGEN PATCHING 2/4 # # Upon encountering a block element nested in , we need to act. @@ -401,22 +412,43 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET. out.return_value = parse_desc(state, i) else: has_block_elements = True - if i.attrib['kind'] == 'see': - out.parsed += '