Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More

lino.utils.html

Some HTML utilities for Lino.

Functions

assert_safe(s)

Raise an exception if the given text s is not a safe string.

html2text(html, **kwargs)

Convert the given HTML-formatted text into equivalent Markdown-structured text using html2text.

py2html(obj, name)

tostring(v, *args, **kw)

Render the given ElementTree element v as an escaped ("safe") str containing HTML.

Classes

Grouper(ar)

lino.utils.html.html2text(html, **kwargs)

Convert the given HTML-formatted text into equivalent Markdown-structured text using html2text.

lino.utils.html.tostring(v, *args, **kw)

Render the given ElementTree element v as an escaped (“safe”) str containing HTML.

If the value is not an ElementTree element, just convert it into a str.

If the value is a generator, list or tuple, convert each item individually and concatenate their HTML.

This started as a copy of etgen.html.tostring() but uses Django’s concept of safe strings.

lino.utils.html.assert_safe(s)

Raise an exception if the given text s is not a safe string.