From 8a9a1721f09680019058e1375706aa7d83ecf9f2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 14 Dec 2017 18:48:08 +0100 Subject: [PATCH] doxygen: minor code reorganization. --- doxygen/dox2html5.py | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/doxygen/dox2html5.py b/doxygen/dox2html5.py index c8ab08c8..9feab44a 100755 --- a/doxygen/dox2html5.py +++ b/doxygen/dox2html5.py @@ -531,6 +531,25 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET. has_block_elements = True out.parsed += '
{}
'.format(html.escape(i.text)) + elif i.tag == 'image': + assert element.tag == 'para' # is inside a paragraph :/ + has_block_elements = True + + name = i.attrib['name'] + if i.attrib['type'] == 'html': + path = os.path.join(state.basedir, state.doxyfile['OUTPUT_DIRECTORY'], state.doxyfile['XML_OUTPUT'], name) + if os.path.exists(path): + state.images += [path] + else: + logging.warning("Image {} was not found in XML_OUTPUT".format(name)) + + caption = i.text + if caption: + out.parsed += '
Image
{}
'.format(name, html.escape(caption)) + else: + out.parsed += 'Image'.format(name) + + # Either block or inline elif i.tag == 'programlisting': assert element.tag == 'para' # is inside a paragraph :/ @@ -626,25 +645,7 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET. highlighted = highlighted.rstrip() if code_block else highlighted.strip() out.parsed += '<{0} class="{1}">{2}'.format('pre' if code_block else 'code', class_, highlighted) - elif i.tag == 'image': - assert element.tag == 'para' # is inside a paragraph :/ - has_block_elements = True - - name = i.attrib['name'] - if i.attrib['type'] == 'html': - path = os.path.join(state.basedir, state.doxyfile['OUTPUT_DIRECTORY'], state.doxyfile['XML_OUTPUT'], name) - if os.path.exists(path): - state.images += [path] - else: - logging.warning("Image {} was not found in XML_OUTPUT".format(name)) - - caption = i.text - if caption: - out.parsed += '
Image
{}
'.format(name, html.escape(caption)) - else: - out.parsed += 'Image'.format(name) - - # Either block or inline because DOXYGEN!!! WHAT!!! + # Either block or inline elif i.tag == 'formula': assert element.tag == 'para' # is inside a paragraph :/ -- 2.30.2