Repository: rmcgibbo/sphinxcontrib-autodoc_doxygen

Issue:
Omit namespace and class from method names
I did this by changing line 134 of autodoc.py from

    return (rtype and (rtype + ' ') or '') + self.modname + '::' + self.objpath

to

    return (rtype and (rtype + ' ') or '') + self.objpath

You mentioned before that this caused links to methods to be broken, but as far as I can tell it seems to work fine.

By the way, all the examples at https://rawgit.com/rmcgibbo/sphinxcontrib-autodoc_doxygen/gh-pages/autodoxyclass.html include the option `:members:`.  When I include that, I get the error message

    ERROR: An option to autodoxyclass is either unknown or has an invalid value: 'members'

If I omit it, everything seems to work correctly.

Discussion:

Patch:
diff --git a/sphinxcontrib/autodoc_doxygen/autodoc.py b/sphinxcontrib/autodoc_doxygen/autodoc.py
index 6bfbdd6..c32508b 100644
--- a/sphinxcontrib/autodoc_doxygen/autodoc.py
+++ b/sphinxcontrib/autodoc_doxygen/autodoc.py
@@ -154,7 +154,10 @@ class DoxygenMethodDocumenter(DoxygenDocumenter):
         return doc
 
     def format_name(self):
-        return self.object.find('definition').text
+        # return self.object.find('definition').text
+        rtype = '\n'.join(format_xml_paragraph(self.object.find('type'))).strip()
+        return (rtype and (rtype + ' ') or '') + self.objname
+
 
     def format_signature(self):
         args = self.object.find('argsstring').text
diff --git a/sphinxcontrib/autodoc_doxygen/xmlutils.py b/sphinxcontrib/autodoc_doxygen/xmlutils.py
index 07567a4..31df3ad 100644
--- a/sphinxcontrib/autodoc_doxygen/xmlutils.py
+++ b/sphinxcontrib/autodoc_doxygen/xmlutils.py
@@ -60,7 +60,9 @@ class _DoxygenXmlParagraphFormatter(object):
             val.extend((' <', real_name, '>`'))
         else:
             val.append('`')
-        val.append(node.tail)
+        if node.tail is not None:
+            val.append(node.tail)
+
         self.lines[-1] += ''.join(val)
 
     def visit_para(self, node):


Test patch:
diff --git a/tests/test_format_xml_paragraph.py b/tests/test_format_xml_paragraph.py
index 66fb8e7..b795b7b 100644
--- a/tests/test_format_xml_paragraph.py
+++ b/tests/test_format_xml_paragraph.py
@@ -76,4 +76,11 @@ The above example has two problems. First, it does not respect distance constrai
   integrator.addConstrainVelocities();
 
 """
-    assert '\n'.join(format_xml_paragraph(node)) == expected
\ No newline at end of file
+    assert '\n'.join(format_xml_paragraph(node)) == expected
+
+
+def test_3():
+    node = ET.fromstring("""
+<type><ref refid="classOpenMM_1_1CustomHbondForce_1afefd9143292586209274d8e355d8cba1" kindref="member">NonbondedMethod</ref></type>""")
+    expected = ':cpp:any:`NonbondedMethod`'
+    assert '\n'.join(format_xml_paragraph(node)) == expected