module documentation

Collection of helper functions and classes related to the creation and processing of docutils nodes.

Class obj_reference A reference to a documentable object.
Class wbr Word break opportunity.
Function build_table_of_content Simplified from docutils Contents transform.
Function get_lineno Get the 0-based line number for a docutils `nodes.title_reference`.
Function set_node_attributes Set the attributes of a Node and return the modified node. This is required to manually construct a docutils document that is consistent.
Function _set_nodes_parent Set the nodes.Node.parent attribute of the nodes to the defined parent.
def build_table_of_content(node, depth, level=0): (source)

Simplified from docutils Contents transform.

All section nodes MUST have set attribute 'ids' to a list of strings.

Parameters
node:nodes.NodeUndocumented
depth:intUndocumented
level:intUndocumented
Returns
Optional[nodes.Node]Undocumented
def get_lineno(node): (source)

Get the 0-based line number for a docutils `nodes.title_reference`.

Walk up the tree hierarchy until we find an element with a line number, then counts the number of newlines until the reference element is found.

Parameters
node:nodes.NodeUndocumented
Returns
intUndocumented
def set_node_attributes(node, document=None, lineno=None, children=None): (source)

Set the attributes of a Node and return the modified node. This is required to manually construct a docutils document that is consistent.

Parameters
node:nodes.NodeA node to edit.
document:Optional[nodes.document]The nodes.Node.document attribute.
lineno:Optional[int]The nodes.Node.line attribute.
children:Optional[Iterable[nodes.Node]]The nodes.Element.children attribute. Special care is taken to appropriately set the nodes.Node.parent attribute on the child nodes.
Returns
nodes.NodeUndocumented
def _set_nodes_parent(nodes, parent): (source)

Set the nodes.Node.parent attribute of the nodes to the defined parent.

Parameters
nodes:Iterable[nodes.Node]Undocumented
parent:nodes.ElementUndocumented
Returns
Iterator[nodes.Node]An iterator containing the modified nodes.