TagTemplate

class domilite.template.TagTemplate(tag: type[H], attributes: Mapping[str, str | bool] | None = None, classes: Iterable[str] | None = None)[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

aria

A helper property for accessing attributes with a prefix.

attributes

Property access to Attributes

classes

Property access to Classes

data

A helper property for accessing attributes with a prefix.

hx

A helper property for accessing attributes with a prefix.

Methods Summary

__call__(*args, **kwds)

Create a tag from the attributes and classes.

update(tag)

Update the tag with the attributes and classes.

Attributes Documentation

aria: PrefixAccessor[TagTemplate]

A helper property for accessing attributes with a prefix.

See PrefixAccess

attributes: ClassVar[AttributesProperty[TagTemplate]]

Property access to Attributes

classes: ClassVar[ClassesProperty[TagTemplate]]

Property access to Classes

data: PrefixAccessor[TagTemplate]

A helper property for accessing attributes with a prefix.

See PrefixAccess

hx: PrefixAccessor[TagTemplate]

A helper property for accessing attributes with a prefix.

See PrefixAccess

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.

update(tag: H) H[source]

Update the tag with the attributes and classes.