From 0bca7d74c00244c3a8aa67ca214e35188f7be30f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 9 Feb 2018 22:43:17 +0100 Subject: [PATCH] doxygen: implement remaining kinds of section commands. In particular: - \author, \authors, \copyright - \version, \since - \date - \pre, \post, \invariant - \par and RCS entries (`$Id: something $`) The \par is now also able to append to previous sections of any kind if its title is omitted. --- doxygen/dox2html5.py | 50 ++++++++++++++++++------- doxygen/test/contents_blocks/index.html | 2 +- doxygen/test/contents_blocks/input.dox | 22 ++++++++++- 3 files changed, 59 insertions(+), 15 deletions(-) diff --git a/doxygen/dox2html5.py b/doxygen/dox2html5.py index d2d3f4d0..70a2d0cf 100755 --- a/doxygen/dox2html5.py +++ b/doxygen/dox2html5.py @@ -638,15 +638,18 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET. tag = 'h3' elif element.tag == 'sect3': tag = 'h4' - else: # pragma: no cover - assert False - id = extract_id(element) - title = html.escape(i.text) + elif not element.tag == 'simplesect': + assert False # pragma: no cover + + # simplesect titles are handled directly inside simplesect + if not element.tag == 'simplesect': + id = extract_id(element) + title = html.escape(i.text) - # Populate section info - assert not out.section - out.section = (id, title, []) - out.parsed += '<{0}>{2}'.format(tag, id, title) + # Populate section info + assert not out.section + out.section = (id, title, []) + out.parsed += '<{0}>{2}'.format(tag, id, title) elif i.tag == 'heading': assert element.tag == 'para' # is inside a paragraph :/ @@ -794,19 +797,16 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET. logging.warning("{}: superfluous @return section found, ignoring: {} ".format(state.current, ''.join(i.itertext()))) else: out.return_value = parse_desc(state, i) - # Ignore the RCS strings for now - elif i.attrib['kind'] == 'rcs': - logging.warning("{}: ignoring {} kind of ".format(state.current, i.attrib['kind'])) else: has_block_elements = True # There was a section open, but it differs from this one, close # it - if previous_section and previous_section != i.attrib['kind']: + if previous_section and ((i.attrib['kind'] != 'par' and previous_section != i.attrib['kind']) or (i.attrib['kind'] == 'par' and i.find('title').text)): out.parsed = out.parsed.rstrip() + '' # Not continuing with a section from before, put a header in - if not previous_section or previous_section != i.attrib['kind']: + if not previous_section or (i.attrib['kind'] != 'par' and previous_section != i.attrib['kind']) or (i.attrib['kind'] == 'par' and i.find('title').text): if i.attrib['kind'] == 'see': out.parsed += '