documentation

pull/1/head
panhongyang 2023-02-06 13:40:29 +08:00
parent d724f7eea6
commit f6f4d32780
3 changed files with 90 additions and 9 deletions

View File

@ -53,9 +53,9 @@ author = 'Hongyang Pan'
# built documents.
#
# The short X.Y version.
version = '0.1.2'
version = 'v1.0'
# The full version, including alpha/beta/rc tags.
release = '0.1.2'
release = 'v1.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@ -162,3 +162,78 @@ texinfo_documents = [
author, 'phyLS', '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 = {"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)

View File

@ -32,10 +32,3 @@ Welcome to phyLS's documentation!
exprsim
sat
sim
Indices and tables
==================
.. * :ref:`genindex`
.. * :ref:`modindex`
.. * :ref:`search`

View File

@ -0,0 +1,13 @@
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