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.

layout2html(ar, elem)

py2html(obj, name)

table2html(ar[, as_main])

Represent the given table request as an HTML table.

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.

lino.utils.html.table2html(ar, as_main=True)

Represent the given table request as an HTML table.

ar is the request to be rendered, an instance of lino.core.requests.ActionRequest.

The returned HTML enclosed in a <div> tag and generated using etgen.html.

If as_main is True, include additional elements such as a paging toolbar. (This argument is currently being ignored.)