import os.path
import re
import sys
+import traceback # debug, big time
from six import itervalues
from lxml import etree as ET
"""
return [l.rstrip() for l in _DoxygenXmlParagraphFormatter().generic_visit(xmlnode).lines]
-
+def elm2xml(xelm):
+ """Return the unparsed form of the element"""
+ res = '<{}'.format(xelm.tag)
+ for key in xelm.keys():
+ res += ' {}="{}"'.format(key, xelm.attrib[key])
+ res += ">"
+ if xelm.text is not None: # Text before the first child
+ res += xelm.text
+ for i in xelm.getchildren(): # serialize every subtag
+ res += elm2xml(i)
+ if xelm.tail is not None: # Text after last child
+ res += xelm.tail
+ res += '</{}>'.format(xelm.tag)
+ return res
+def elm2txt(xelm):
+ """Return the content of the element, with all tags removed. Only the text remains"""
+ res = ''
+ if xelm.text is not None: # Text before the first child
+ res += xelm.text
+ for i in xelm.getchildren(): # serialize every subtag
+ res += elm2txt(i)
+ if xelm.tail is not None: # Text after last child
+ res += xelm.tail
+ return res
+
class _DoxygenXmlParagraphFormatter(object):
# This class follows the model of the stdlib's ast.NodeVisitor for tree traversal
# where you dispatch on the element type to a different method for each node
return False
def parse_id(self, id_to_parse):
+ print("Parse ID {}".format(id_to_parse))
xp = './/*[@id="%s"]' % id_to_parse
match = get_doxygen_root().xpath(xp)
if match:
match = match[0]
+ print("ID: {}".format(elm2xml(match)))
self.fullname = match.find('./definition').text.split()[-1]
self.modname = self.fullname
self.objname = match.find('./name').text
# classname or method name
return True
+# sys.stderr.write("fullname: {}".format(self.fullname))
+# traceback.print_stack()
if '::' in self.fullname:
(obj, meth) = self.fullname.rsplit('::', 1)
# 'public-func' and 'public-static-func' are for classes while 'func' alone is for namespaces
logger.warning("[autodoxy] WARNING: Could not find method {}{}{}".format(obj, meth, self.argsstring))
if not candidates:
logger.warning("[autodoxy] WARNING: (no candidate found)")
+ logger.warning("Query was: {}".format(xpath_query))
for cand in candidates:
logger.warning("[autodoxy] WARNING: Existing candidate: {}{}{}".format(obj, meth, cand.find('argsstring').text))
else:
def document_members(self, all_members=False):
pass
-def elm2xml(xelm):
- """Return the unparsed form of the element"""
- res = '<{}'.format(xelm.tag)
- for key in xelm.keys():
- res += ' {}="{}"'.format(key, xelm.attrib[key])
- res += ">"
- if xelm.text is not None: # Text before the first child
- res += xelm.text
- for i in xelm.getchildren(): # serialize every subtag
- res += elm2xml(i)
- if xelm.tail is not None: # Text after last child
- res += xelm.tail
- res += '</{}>'.format(xelm.tag)
- return res
-def elm2txt(xelm):
- """Return the content of the element, with all tags removed. Only the text remains"""
- res = ''
- if xelm.text is not None: # Text before the first child
- res += xelm.text
- for i in xelm.getchildren(): # serialize every subtag
- res += elm2txt(i)
- if xelm.tail is not None: # Text after last child
- res += xelm.tail
- return res
-
class DoxygenVariableDocumenter(DoxygenDocumenter):
objtype = 'doxyvar'
directivetype = 'var'