Skip to content

Commit

Permalink
Add docstirng to doc.getdoc() and reference it in doc.explain()s …
Browse files Browse the repository at this point in the history
…docstring.
  • Loading branch information
doerwalter committed May 9, 2022
1 parent 250d86a commit 6033a2b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/ll/xist/ns/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,24 @@ def _getmodulename(thing):


def getdoc(thing, format):
"""
Return the docstring for ``thing``, as an XIST node using this namespace module.
``format`` specifies how to treat the docstring:
``"plaintext"
Treat to docstring as text. This returns a single :class:`~ll.xist.xsc.Text`
node.
``"restructuredtext"``.
This interprets the docstring as ReST source and converts it to use
this namespace.
``"xist"``
This treats the docstring as XML, which will be parsed using this
namespace as the default namespace.
"""

if thing.__doc__ is None:
return xsc.Null

Expand Down Expand Up @@ -199,6 +217,8 @@ def explain(thing, name=None, format=None, context=[]):
i.e. a list of names of objects into which ``thing`` is nested. This
means the first entry will always be the module name, and the other entries
will be class names.
For the meaning for ``format`` see, :func:`getdoc`.
"""

def _append(all, obj, varname):
Expand Down

0 comments on commit 6033a2b

Please sign in to comment.