i¶
- class domilite.tags.i(*args: str | dom_tag | Markup, **kwargs: str | bool)[source]¶
Bases:
html_tagThe <i> HTML element represents a range of text that is set off from the normal text for some reason, such as idiomatic text, technical terms, taxonomical designations, among others.
Attributes Summary
A helper for accessing attributes of the form aria- for accessibility.
The attributes associated with this tag.
The list of child tags or markup objects
The (HTML) classes associated with this tag, managed as a set of strings.
A helper for accessing attributes of the form data- as often used by client JS libraries.
Rendering flags for this tag.
A helper for accessing attributes of the form hx- for htmlx.
The name of this tag, inferred from the name of the class
Methods Summary
add(*children)Add child tags to this tag.
clear()Remove all chilren.
Iterate over all children and children of children recursively.
find_tag_type(name)Find a particular subclass of this tag with a given name.
Iterate through all known subclasses of this tag, recursively.
remove(child)Remove a particular child.
render([indent, flags, pretty, xhtml])Render this tree of tags to a string.
Attributes Documentation
- aria: PrefixAccessor['html_tag']¶
A helper for accessing attributes of the form aria- for accessibility. The aria- prefix is not required on this attribute.
- attributes: ClassVar[AttributesProperty['dom_tag']]¶
The attributes associated with this tag. See
Attributesfor more details.
- children: list['dom_tag | Markup']¶
The list of child tags or markup objects
- classes¶
The (HTML) classes associated with this tag, managed as a set of strings. See
Classesfor more details.
- data: PrefixAccessor['html_tag']¶
A helper for accessing attributes of the form data- as often used by client JS libraries. The data- prefix is not required on this attribute.
- flags: ClassVar['Flags'] = 6¶
Rendering flags for this tag.
- hx: PrefixAccessor['html_tag']¶
A helper for accessing attributes of the form hx- for htmlx. The hx- prefix is not required on this attribute.
- name: Name = 'i'¶
The name of this tag, inferred from the name of the class
Methods Documentation
- add(*children: dom_tag | str | Markup) Self¶
Add child tags to this tag.
- Parameters:
children (tag, string, or Markup) – Tags become children, strings are escaped, and Markup is text that is added raw to this tag.
- Returns:
self
- Return type:
this tag, to facilitate method chaining
- clear() Self¶
Remove all chilren.
- Returns:
self
- Return type:
this tag, to facilitate method chaining
- classmethod find_tag_type(name: str) type[Self] | None¶
Find a particular subclass of this tag with a given name.
- classmethod iter_subclasses() Iterator[type[Self]]¶
Iterate through all known subclasses of this tag, recursively.
- remove(child: dom_tag | Markup) Self¶
Remove a particular child. If you are removing a string, escape it first with
Markup.escape().- Parameters:
child (tag or Markup) – Child to remove. If it doesn’t exist, an error will be raised.
- Returns:
self
- Return type:
this tag, to facilitate method chaining
- render(indent: str = ' ', flags: ~domilite.render.RenderFlags = <RenderFlags.PRETTY: 1>, pretty: bool | None = None, xhtml: bool | None = None) str¶
Render this tree of tags to a string.
- Parameters:
indent (str, optional) – String to use for indenting in pretty mode. Defaults to two spaces: ` `
flags (
RenderFlags) – Adjust the rendering properties to use (e.g. turn off PRETTY)pretty (bool or None) – Explicitly enable or disable pretty rendering.
xhtml (bool or None) – Explicitly enable or disable xhtml rendering.