X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fb9d73b23b30461efaba93282e05ccf0cde2f395..d1db98662081c1ad310c5282842f49c447b5c9b3:/docs/source/_ext/autodoxy.py diff --git a/docs/source/_ext/autodoxy.py b/docs/source/_ext/autodoxy.py index 07efce4102..3b277efdfd 100644 --- a/docs/source/_ext/autodoxy.py +++ b/docs/source/_ext/autodoxy.py @@ -15,6 +15,7 @@ from __future__ import print_function, absolute_import, division import os.path import re import sys +import traceback # debug, big time from six import itervalues from lxml import etree as ET @@ -45,7 +46,31 @@ def format_xml_paragraph(xmlnode): """ 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 @@ -377,10 +402,12 @@ class DoxygenMethodDocumenter(DoxygenDocumenter): 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 @@ -394,6 +421,8 @@ class DoxygenMethodDocumenter(DoxygenDocumenter): # 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 @@ -424,6 +453,7 @@ class DoxygenMethodDocumenter(DoxygenDocumenter): 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: @@ -476,31 +506,6 @@ class DoxygenMethodDocumenter(DoxygenDocumenter): 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'