Tag

class bootlace.util.Tag(tag: type[H], classes: set[str] = NOTHING, attributes: dict[str, str] = NOTHING)[source]

Bases: Generic[H]

A helper for creating tags.

Holds the tag type as well as attributes for the tag. This can be used by calling the instance as a function to create a tag, or by calling the update() method to apply the attributes to an existing tag.

Attributes Summary

attributes

The attributes to apply to the tag

classes

The classes to apply to the tag

tag

The tag type

Methods Summary

__call__(*args, **kwds)

Create a tag from the attributes and classes.

__tag__()

Create a tag from the attributes and classes.

update(tag)

Update the tag with the attributes and classes.

Attributes Documentation

attributes: dict[str, str]

The attributes to apply to the tag

classes: set[str]

The classes to apply to the tag

tag: type[H]

The tag type

Methods Documentation

__call__(*args: Any, **kwds: Any) H[source]

Create a tag from the attributes and classes.

This method is a convenience wrapper around __tag__() that allows the tag to be created with additional arguments and keyword arguments passed to the tag constructor.

__tag__() H[source]

Create a tag from the attributes and classes.

update(tag: H) H[source]

Update the tag with the attributes and classes.