From: Vladimír Vondruš Date: Fri, 5 Jan 2018 00:32:10 +0000 (+0100) Subject: doxygen: improve diagnostic output. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=6f95cebe621b914fea0ae17fb194333efae28c9c;p=blog.git 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. --- 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 += '