X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fa9a1f65578e3efecc870b4d0cbc8e25a22e1918..344eb668e7f5738a68591870bd2a3e00a135854f:/docs/source/_ext/autodoxy.py diff --git a/docs/source/_ext/autodoxy.py b/docs/source/_ext/autodoxy.py index f0105da8e5..af672a227d 100644 --- a/docs/source/_ext/autodoxy.py +++ b/docs/source/_ext/autodoxy.py @@ -191,12 +191,12 @@ class DoxygenDocumenter(Documenter): 'members': members_option, } - def __init__(self, directive, name, indent=u'', id=None): + def __init__(self, directive, name, indent=u'', my_id = None): super(DoxygenDocumenter, self).__init__(directive, name, indent) - if id is not None: - self.parse_id(id) + if my_id is not None: + self.parse_id(my_id) - def parse_id(self, id): + def parse_id(self, id_to_parse): return False def parse_name(self): @@ -238,6 +238,7 @@ class DoxygenDocumenter(Documenter): directive = getattr(self, 'directivetype', self.objtype) name = self.format_name() sourcename = self.get_sourcename() + #print('.. %s:%s:: %s%s' % (domain, directive, name, sig)) self.add_line(u'.. %s:%s:: %s%s' % (domain, directive, name, sig), sourcename) @@ -360,8 +361,8 @@ class DoxygenMethodDocumenter(DoxygenDocumenter): return True return False - def parse_id(self, id): - xp = './/*[@id="%s"]' % id + def parse_id(self, id_to_parse): + xp = './/*[@id="%s"]' % id_to_parse match = get_doxygen_root().xpath(xp) if match: match = match[0] @@ -378,15 +379,20 @@ class DoxygenMethodDocumenter(DoxygenDocumenter): # classname or method name return True - (obj, meth) = self.fullname.rsplit('::', 1) + 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 + prefix = './/compoundname[text()="{:s}"]/../sectiondef[@kind="public-func" or @kind="public-static-func" or @kind="func"]'.format(obj) + obj = "{:s}::".format(obj) + else: + meth = self.fullname + prefix = './' + obj = '' - 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_noparam = ('{:s}/memberdef[@kind="function"]/name[text()="{:s}"]/..').format(prefix, meth) xpath_query = "" -# 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) + xpath_query = ('{:s}/memberdef[@kind="function" and argsstring/text()="{:s}"]/name[text()="{:s}"]/..').format(prefix,self.argsstring,meth) else: xpath_query = xpath_query_noparam match = get_doxygen_root().xpath(xpath_query) @@ -396,15 +402,17 @@ class DoxygenMethodDocumenter(DoxygenDocumenter): if self.argsstring != None: candidates = get_doxygen_root().xpath(xpath_query_noparam) if len(candidates) == 1: - logger.warning("[autodoxy] Using method '{}::{}{}' instead of '{}::{}{}'. You may want to drop your specification of the signature, or to fix it." - .format(obj, meth, candidates[0].find('argsstring').text, obj, meth, self.argsstring)) + logger.warning("[autodoxy] Using method '{}{}{}' instead of '{}{}{}'. You may want to drop your specification of the signature, or to fix it." + .format(obj, meth, candidates[0].find('argsstring').text, obj, meth, self.argsstring)) self.object = candidates[0] return True - logger.warning("[autodoxy] WARNING: Could not find method {}::{}{}".format(obj, meth, self.argsstring)) + logger.warning("[autodoxy] WARNING: Could not find method {}{}{}".format(obj, meth, self.argsstring)) + if not candidates: + logger.warning("[autodoxy] WARNING: (no candidate found)") for cand in candidates: - logger.warning("[autodoxy] WARNING: Existing candidate: {}::{}{}".format(obj, meth, cand.find('argsstring').text)) + logger.warning("[autodoxy] WARNING: Existing candidate: {}{}{}".format(obj, meth, cand.find('argsstring').text)) else: - logger.warning("[autodoxy] WARNING: could not find method {}::{} in Doxygen files".format(obj, meth)) + logger.warning("[autodoxy] WARNING: Could not find method {}{} in Doxygen files\nQuery: {}".format(obj, meth, xpath_query)) return False self.object = match[0] return True @@ -484,8 +492,8 @@ class DoxygenVariableDocumenter(DoxygenDocumenter): self.object = match[0] return True - def parse_id(self, id): - xp = './/*[@id="%s"]' % id + def parse_id(self, id_to_parse): + xp = './/*[@id="%s"]' % id_to_parse match = get_doxygen_root().xpath(xp) if match: match = match[0] @@ -513,7 +521,7 @@ class DoxygenVariableDocumenter(DoxygenDocumenter): else: rtype = rtype_el.text - # print("rtype: {}".format(rtype)) +# print("rtype: {}".format(rtype)) signame = (rtype and (rtype + ' ') or '') + self.klassname + "::" + self.objname return self.format_template_name() + signame @@ -555,8 +563,8 @@ def set_doxygen_xml(app): raise err setup.DOXYGEN_ROOT = ET.ElementTree(ET.Element('root')).getroot() - for file in files: - root = ET.parse(file).getroot() + for current_file in files: + root = ET.parse(current_file).getroot() for node in root: setup.DOXYGEN_ROOT.append(node)