From: Martin Quinson Date: Sat, 9 Nov 2019 21:06:59 +0000 (+0100) Subject: autodoxy: properly render verbatim blocks X-Git-Tag: v3.25~425 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/d9ce3e88a926975971cb5827f6bfcd8c099af038 autodoxy: properly render verbatim blocks --- diff --git a/docs/source/Doxyfile b/docs/source/Doxyfile index 464237c5bc..44b2cb532c 100644 --- a/docs/source/Doxyfile +++ b/docs/source/Doxyfile @@ -31,7 +31,7 @@ XML_PROGRAMLISTING = NO # No program listings, please CREATE_SUBDIRS = NO # Mandatory for exhale # Allow for rst directives and advanced functions e.g. grid tables -ALIASES = "rst=\verbatim embed:rst:leading-asterisk" +ALIASES = "beginrst=\verbatim " ALIASES += "endrst=\endverbatim" # Enable preprocessing and related preprocessor necessities diff --git a/docs/source/_ext/autodoxy/autodoxy/autodoxy.py b/docs/source/_ext/autodoxy/autodoxy/autodoxy.py index 7719ec587f..af8c96fbc7 100644 --- a/docs/source/_ext/autodoxy/autodoxy/autodoxy.py +++ b/docs/source/_ext/autodoxy/autodoxy/autodoxy.py @@ -219,7 +219,7 @@ class DoxygenMethodDocumenter(DoxygenDocumenter): xpath_query_noparam = ('.//compoundname[text()="{:s}"]/../sectiondef[@kind="public-func" or @kind="public-static-func"]' '/memberdef[@kind="function"]/name[text()="{:s}"]/..').format(obj, meth) xpath_query = "" - print("fullname {}".format(self.fullname)) +# print("fullname {}".format(self.fullname)) if self.argsstring != None: xpath_query = ('.//compoundname[text()="{:s}"]/../sectiondef[@kind="public-func" or @kind="public-static-func"]' '/memberdef[@kind="function" and argsstring/text()="{:s}"]/name[text()="{:s}"]/..').format(obj,self.argsstring,meth) @@ -234,10 +234,8 @@ class DoxygenMethodDocumenter(DoxygenDocumenter): for cand in get_doxygen_root().xpath(xpath_query_noparam): logger.warning("[autodoxy] WARNING: Existing candidate: {}::{}{}".format(obj, meth, cand.find('argsstring').text)) else: - logger.warning("[autodoxy] WARNING: could not find method {}::{}{}".format(obj, meth)) - - raise ExtensionError(('[autodoxy] could not find method (modname="{:s}", objname="{:s}"). I tried ' - 'the following xpath: "{:s}"').format(obj, meth, xpath_query)) + logger.warning("[autodoxy] WARNING: could not find method {}::{} in Doxygen files".format(obj, meth)) + return False self.object = match[0] return True diff --git a/docs/source/_ext/autodoxy/autodoxy/xmlutils.py b/docs/source/_ext/autodoxy/autodoxy/xmlutils.py index 7aa507fa98..582f0a47c7 100644 --- a/docs/source/_ext/autodoxy/autodoxy/xmlutils.py +++ b/docs/source/_ext/autodoxy/autodoxy/xmlutils.py @@ -1,6 +1,6 @@ from __future__ import print_function, absolute_import, division from . import get_doxygen_root - +import re def format_xml_paragraph(xmlnode): """Format an Doxygen XML segment (principally a detaileddescription) @@ -75,6 +75,26 @@ class _DoxygenXmlParagraphFormatter(object): self.lines.append('') self.continue_line = False + def visit_verbatim(self, node): + if node.text is not None: + # remove the leading ' *' of any lines + lines = [re.sub('^\s*\*','', l) for l in node.text.split('\n')] + # Merge each paragraph together + text = re.sub("\n\n", "PaRaGrraphSplit", '\n'.join(lines)) + text = re.sub('\n', '', text) + lines = text.split('PaRaGrraphSplit') + + # merge content to the built doc + if self.continue_line: + self.lines[-1] += lines[0] + lines = lines[1:] + for l in lines: + self.lines.append('') + self.lines.append(l) + self.generic_visit(node) + self.lines.append('') + self.continue_line = False + def visit_parametername(self, node): if 'direction' in node.attrib: direction = '[%s] ' % node.get('direction') @@ -126,3 +146,4 @@ class _DoxygenXmlParagraphFormatter(object): def visit_subscript(self, node): self.lines[-1] += '\ :sub:`%s` %s' % (node.text, node.tail) +