diff options
Diffstat (limited to 'mu4web/html_render.py')
-rw-r--r-- | mu4web/html_render.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/mu4web/html_render.py b/mu4web/html_render.py index fc608fb..f9c9aa8 100644 --- a/mu4web/html_render.py +++ b/mu4web/html_render.py @@ -1,5 +1,15 @@ +""" +Render python structures into HTML strings. + +Instead of constructing HTML strings manually or through templates, +instead write python structures, and serialize them at the last +possible moment. See ``render_document`` for a detailed explanation of +valid types. +""" + import html from typing import ( + Any, Callable, Union, ) @@ -11,7 +21,9 @@ except ImportError: # TODO compare this against xml.etree.ElementTree, which appears to # have a HTML mode. -HTML: TypeAlias = Union[tuple, +# ``tuple[Any, ...]`` should really be ``tuple['HTML', ...]``, but +# that doesn't work for some reason. +HTML: TypeAlias = Union[tuple[Any, ...], list['HTML'], Callable[[], str], None, str, int, float] |