express.ui.TagList
express.ui.TagList(*args)Create an HTML tag list (i.e., a fragment of HTML)
Parameters
*args : TagChild = ()-
The tag children to add to the list.
Examples
>>> from htmltools import TagList, div
>>> TagList("hello", div(id="foo", class_="bar"))
hello
<div id="foo" class="bar"></div>Methods
| Name | Description |
|---|---|
| append | Append tag children to the end of the list. |
| extend | Extend the children by appending an iterable of children. |
| get_dependencies | Get any dependencies needed to render the HTML. |
| get_html_string | Return the HTML string for this tag list. |
| insert | Insert tag children before a given index. |
| render | Get string representation as well as its HTML dependencies. |
| save_html | Save to a HTML file. |
| show | Preview as a complete HTML document. |
| tagify | Convert any tagifiable children to Tag/TagList objects. |
append
express.ui.TagList.append(item, *args)Append tag children to the end of the list.
extend
express.ui.TagList.extend(other)Extend the children by appending an iterable of children.
get_dependencies
express.ui.TagList.get_dependencies(dedup=True)Get any dependencies needed to render the HTML.
Parameters
dedup : bool = True-
Whether to deduplicate the dependencies.
get_html_string
express.ui.TagList.get_html_string(
indent=0,
eol='\n',
*,
add_ws=True,
_escape_strings=True,
)Return the HTML string for this tag list.
Parameters
indent : int = 0-
Number of spaces to indent each line of the HTML.
eol : str = ''-
End-of-line character(s).
add_ws : bool = True-
Whether to add whitespace between the opening tag and the first child. If either this is True, or the child’s add_ws attribute is True, then whitespace will be added; if they are both False, then no whitespace will be added.
insert
express.ui.TagList.insert(i, item)Insert tag children before a given index.
render
express.ui.TagList.render()Get string representation as well as its HTML dependencies.
save_html
express.ui.TagList.save_html(file, *, libdir='lib', include_version=True)Save to a HTML file.
Parameters
Returns
: str-
The path to the generated HTML file.
show
express.ui.TagList.show(renderer='auto')Preview as a complete HTML document.
Parameters
renderer : Literal[‘auto’, ‘ipython’, ‘browser’] = 'auto'-
The renderer to use.
tagify
express.ui.TagList.tagify()Convert any tagifiable children to Tag/TagList objects.