module documentation

Utilities related to Stan tree building and HTML flattening.

Function flatten Convert a document fragment from a Stan tree to HTML.
Function flatten_text Return the text inside a stan tree.
Function html2stan Convert an HTML string to a Stan tree.
Constant _RE_CONTROL Undocumented
def flatten(stan: Flattenable) -> str: (source)

Convert a document fragment from a Stan tree to HTML.

Parameters
stan:FlattenableDocument fragment to flatten.
Returns
strAn HTML string representation of the stan tree.
def flatten_text(stan: Flattenable) -> str: (source)

Return the text inside a stan tree.

Note
Only compatible with Tag, generators, and lists.
def html2stan(html: bytes | str) -> Tag: (source)

Convert an HTML string to a Stan tree.

Parameters
html:bytes | strAn HTML fragment; multiple roots are allowed.
Returns
TagThe fragment as a tree with a transparent root node.
Raises
xml.sax.SAXParseExceptionIf XMLString fails to parse the html data. See https://github.com/twisted/twisted/issues/11581.
_RE_CONTROL = (source)

Undocumented

Value
re.compile(('[' + ''.join((ch for ch in map(chr, range(0, 32)) if ch not in '\r\
n\t\x0c')) + ']').encode())