document12743%python.module
fault.text

Document finalization and query tools for raw text element trees.

itertools
import

typing0
import

string0
import

types0
import

export422%
function
types.Paragraph

export(paragraph, literal, reference)

Convert the given paragraph element into terms defined by fault.text.types.

exportParameters

paragraph

The raw parse elements formed by Parser.process.

literal

Default cast for literals.

reference

Default cast for references.

sections420%
function
typing.Iterator[typing.Tuple[str, object]]

sections(root)

Iterator producing (section-identifier, section) pairs.

section420%
function
object

section(root, identifier)

Select the section with the given identifier. Uses a full scan; index the results of sections using a dict for repeat reads.

concatenate516%
function
typing.Iterator[str]

concatenate(syntax)

Concatenate the lines of the given syntax element.

context30%
function

context(element)

Structure a common context admonition.

paragraph_as_string70%
function

paragraph_as_string(element)

paragraph_only50%
function

paragraph_only(element)

Select the only paragraph in the given element.

paragraph_first40%
function

paragraph_first(element)

Select the first paragraph in the given element.

paragraph_last40%
function

paragraph_last(element)

Select the last paragraph in the given element.

paragraph_lines80%
function

paragraph_lines(element)

interpret_reference90%
function

interpret_reference(element)

interpret_paragraph_single70%
function

interpret_paragraph_single(element)

directory_pairs60%
function

directory_pairs(items)

Iterate over the key-value pairs in the directory items.

Tree0
class

Serializer for (text) object trees.

Tree__init__0
method

__init__(self)

Initialize the tree builder.

Treeempty20%
method

empty(self, name, *args, **kw)

Empty with potential attributes.

Treeelement0
method

element(self, element_name, content, *attributes, **kwattributes)

Serialize an element with the exact element_name with the contents of subelement_iterator as the inner elements. subelement_iterator must produce bytes encoded objects.

Treeprefixed0
data

prefixed = element

Treeescape0
method

escape(self, string)

Transform0
class

Transform parse events into a form designated by the given AST constructor.

Transformchain0
data

chain = staticmethod(itertools.chain.from_iterable)

Transform__init__0
method

__init__(self, serialization, identify)

Initialize a Transform instance designating the AST constructor.

Transform__init__Parameters

self

Undocumented.

serialization

The serialization instance used to construct the tree.

identify

The function used to prepare an identifier. Normally, a function that prepends on some contextual identifier in order to guarantee uniqueness. For example, lambda x: 'ContextName' + x.

Transformprocess0
method

process(self, tree)

Transformprocess_paragraph_text0
method

process_paragraph_text(self, tree, text)

Transformprocess_paragraph_emphasis0
method

process_paragraph_emphasis(self, tree, data)

Transformprocess_paragraph_literal0
method

process_paragraph_literal(self, tree, data)

Transformprocess_paragraph_reference566%
method

process_paragraph_reference(self, tree, source, type, title, action)

Transformprocess_paragraph_referenceParameters

self

Undocumented.

tree

Undocumented.

source

The reference source; the actual string found to be identified as a reference.

type

The type of reference, one of: 'hyperlink', 'section', None.

title

Undocumented.

action

The effect desired by the reference: 'include' or None. None being a normal reference, and 'include' being induced with a '*' prefixed to the reference

cast

Undocumented.

Transformprocess_end_of_line0
method

process_end_of_line(self, tree, text)

Transformprocess_init0
method

process_init(self, tree, data, *params)

Transformparagraph_index0
data

paragraph_index = {
	'init': process_init,
	'text': process_paragraph_text,
	'eol': process_end_of_line,
	'emphasis': process_paragraph_emphasis,
	'literal': process_paragraph_literal,
	'reference': process_paragraph_reference,
}

Transformprocess_items185%
method

process_items(self, tree, element, name)

Transformprocess_set0
method

process_set(self, tree, element)

Transformprocess_sequence0
method

process_sequence(self, tree, element)

Transformprocess_directory0
method

process_directory(self, tree, vl_element)

Transformempty_paragraph277%
staticmethod

empty_paragraph(sequence)

Whether the paragraph should be considered to be empty.

Transformparagraph_content40%
method

paragraph_content(self, tree, sequence)

Transformprocess_paragraph0
method

process_paragraph(self, tree, paragraph)

Transformprocess_syntax187%
method

process_syntax(self, tree, sequence)

Transformprocess_admonition0
method

process_admonition(self, tree, content)

Transformprocess_section0
method

process_section(self, tree, section)

Transformcreate_section185%
method

create_section(self, tree, section)

Transformprocess_exception30%
method

process_exception(self, tree, exception)

Emit an exception element in order to report warnings or failures regarding syntax that was not entirely comprehensible.

Transformsection_index0
data

section_index = {
	'paragraph': process_paragraph,
	'set': process_set,
	'sequence': process_sequence,
	'directory': process_directory,
	'syntax': process_syntax,
	'admonition': process_admonition,
	'section': create_section,
	'exception': process_exception,
}