From 6f95cebe621b914fea0ae17fb194333efae28c9c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 5 Jan 2018 01:32:10 +0100 Subject: [PATCH] doxygen: improve diagnostic output. Not printing info about every file in the default case anymore, printing just the warnings. In order to make that usable, all warnings are now prefixed with name of file that's being processed. Documentation goal, like with stock Doxygen, is to have zero console output. --- doxygen/dox2html5.py | 54 +++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/doxygen/dox2html5.py b/doxygen/dox2html5.py index 9e41669f..0dd9dab0 100755 --- a/doxygen/dox2html5.py +++ b/doxygen/dox2html5.py @@ -59,6 +59,7 @@ class State: self.compounds: Dict[str, Any] = {} self.doxyfile: Dict[str, str] = {} self.images: List[str] = [] + self.current = '' def slugify(text: str) -> str: # Maybe some Unicode normalization would be nice here? @@ -89,7 +90,7 @@ def parse_ref(state: State, element: ET.Element) -> str: i = id.rindex('_1') url = id[:i] + '.html' + '#' + id[i+2:] else: # pragma: no cover - logging.critical("unknown kind {}".format(element.attrib['kindref'])) + logging.critical("{}: unknown kind {}".format(state.current, element.attrib['kindref'])) assert False if 'external' in element.attrib: @@ -99,7 +100,7 @@ def parse_ref(state: State, element: ET.Element) -> str: url = os.path.join(baseurl, url) break else: # pragma: no cover - logging.critical("tagfile {} not specified in Doxyfile".format(element.attrib['external'])) + logging.critical("{}: tagfile {} not specified in Doxyfile".format(state.current, element.attrib['external'])) assert False class_ = 'm-dox-external' else: @@ -127,7 +128,7 @@ def parse_type(state: State, type: ET.Element) -> str: elif i.tag == 'anchor': out += ''.format(extract_id(i)) else: # pragma: no cover - logging.warning("ignoring {} in ".format(i.tag)) + logging.warning("{}: ignoring {} in ".format(state.current, i.tag)) if i.tail: out += html.escape(i.tail) @@ -280,7 +281,7 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET. elif len([codeline for codeline in i]) > 1: end_previous_paragraph = True code_block = True - logging.warning("Inline code has multiple lines, fallback to a code block") + logging.warning("{}: inline code has multiple lines, fallback to a code block".format(state.current)) # Otherwise wrap it in

and use else: @@ -358,7 +359,7 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET. tag = 'h5' else: # pragma: no cover assert False - logging.warning("Prefer @section over Markdown heading for properly generated TOC") + logging.warning("{}: prefer @section over Markdown heading for properly generated TOC".format(state.current)) out.parsed += '<{0}>{1}'.format(tag, html.escape(i.text)) elif i.tag == 'para': @@ -489,7 +490,7 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET. out.parsed += '