diff --git a/docs/conf.py b/docs/conf.py index 6900e0c..600d67e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -164,68 +164,3 @@ texinfo_documents = [ author, 'percy', 'One line description of project.', 'Miscellaneous'), ] - - -# -- Options for breathe -------------------------------------------------- - -import subprocess, os - -read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True' - -if read_the_docs_build: - subprocess.call('doxygen Doxyfile', shell = True) - -breathe_projects = {"percy": "xml"} -breathe_default_project = "percy" - -# -- Custom directives -------------------------------------------------- - -from docutils import nodes -from docutils.parsers.rst import Directive -from sphinx import addnodes - -def extract_brief(tree, name): - node = tree.findtext("./compounddef/sectiondef/memberdef/[name='%s']/briefdescription/para" % name) - return node.strip() if node else "no brief description" - -class DocBriefDirective(Directive): - has_content = True - def run(self): - tree = self.state.document.settings.env.app.doxyxml - return [nodes.line(text = extract_brief(tree, self.content[0].strip()))] - -class DocBriefTableDirective(Directive): - has_content = True - def run(self): - tree = self.state.document.settings.env.app.doxyxml - table = nodes.table() - tgroup = nodes.tgroup(cols = 2) - tgroup += nodes.colspec(colwidth = 50) - tgroup += nodes.colspec(colwidth = 50) - # header - tgroup += nodes.thead('', nodes.row('', *[nodes.entry('', nodes.line(text = c)) for c in ["Function", "Description"]])) - # rows - tbody = nodes.tbody() - for c in self.content: - name = c.strip() - query = name.replace("&", " &") - for elem in tree.findall("./compounddef/sectiondef/memberdef/[name='%s']" % query): - args = ', '.join(e.text for e in elem.findall("./param/declname")) - ref = addnodes.pending_xref('', refdomain = 'cpp', refexplicit = False, reftype = 'func', reftarget = 'percy::' + name) - ref += nodes.literal(text = '%s(%s)' % (name, args)) - reft = nodes.paragraph() - reft.extend([ref]) - func = nodes.entry('', reft) - desc = nodes.entry('', nodes.line(text = elem.findtext("./briefdescription/para"))) - tbody += nodes.row('', func, desc) - - tgroup += tbody - table += tgroup - - return [table] - -def setup(app): - import xml.etree.ElementTree as ET - app.doxyxml = ET.parse("xml/namespacepercy.xml") - app.add_directive('doc_brief', DocBriefDirective) - app.add_directive('doc_brief_table', DocBriefTableDirective)