Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
autodoxy: properly render verbatim blocks
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sat, 9 Nov 2019 21:06:59 +0000 (22:06 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 10 Nov 2019 18:09:06 +0000 (19:09 +0100)
docs/source/Doxyfile
docs/source/_ext/autodoxy/autodoxy/autodoxy.py
docs/source/_ext/autodoxy/autodoxy/xmlutils.py

index 464237c..44b2cb5 100644 (file)
@@ -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
index 7719ec5..af8c96f 100644 (file)
@@ -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
 
index 7aa507f..582f0a4 100644 (file)
@@ -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)
+