dj_angles.tags

Module Contents

class dj_angles.tags.Tag(tag_map: dict[str | None, collections.abc.Callable | str] | None, html: str, tag_name: str, template_tag_args: str, tag_queue: collections.deque | None = None)

Encapsulates metadata and functionality for a tag that will be processed by dj-angles.

tag_name: str

The portion of the tag’s element name after the initial identifier (which defaults to ‘dj-‘).

Examples

  • ‘include’ for ‘<dj-include />’

  • ‘partial’ for ‘<dj-partial />’

html: str

The original HTML of the tag.

attributes: dj_angles.attributes.Attributes

The parsed attributes of the template tag.

is_shadow: bool = False

Whether or not the tag should use the Shadow DOM.

is_end: bool = False

Whether or not the tag is an end tag, i.e. starts with ‘</’.

is_self_closing: bool = False

Whether or not the tag is self-closing, i.e. ends with ‘/>’.

start_tag: Tag | None = None

The associated start tag. Only set for end tags.

django_template_tag
parse_attributes()

Creates Attributes based on the template tag arguments.

get_django_template_tag(slots: list[tuple[str, minestrone.Element]] | None = None) str

Generate the Django template tag.

Parameters:

slots (param) – List of slots which is a tuple of slot name and inner html.

get_wrapping_tag_name(name: str | None = None) str

Get the wrapping tag name.

Parameters:

name (param) – The name for the wrapping tag.

property is_include

Whether the Django template tag is include.

property component_name

Legacy property for tag_name. Deprecated.