documentation

pull/1/head
panhongyang 2023-02-06 13:59:18 +08:00
parent f6f4d32780
commit 627325d05c
2 changed files with 2 additions and 73 deletions

View File

@ -173,67 +173,4 @@ if read_the_docs_build:
subprocess.call('doxygen Doxyfile', shell = True)
breathe_projects = {"phyLS": "doxyxml/xml"}
breathe_default_project = "phyLS"
# -- 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 = 'phyLS::' + 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("doxyxml/xml/namespacephyLS.xml")
app.add_directive('doc_brief', DocBriefDirective)
app.add_directive('doc_brief_table', DocBriefTableDirective)
breathe_default_project = "phyLS"

View File

@ -2,12 +2,4 @@ Load
=============
The header ``<src/commands/load.hpp>`` implements methods to load
a hexdecimal string represented truth table.
.. doc_brief_table::
is_top_decomposable
is_bottom_decomposable
is_ashenhurst_decomposable
ashenhurst_decomposition
is_bi_decomposable
is_bi_decomposable_mc
a hexdecimal string represented truth table.