dj_angles.tags¶
Module Contents¶
- dj_angles.tags.VOID_ELEMENTS¶
- dj_angles.tags.SHADOW_ATTRIBUTE_KEY = 'shadow'¶
- class dj_angles.tags.Tag(tag_map: dj_angles.mappers.mapper.TagMap | None = 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 />’
- attributes: dj_angles.attributes.Attributes¶
The parsed attributes of the template tag.
- 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.
- get_attribute_value_or_first_key(attribute_name: str) → str¶
Gets the first attribute key or the first value for a particular attribute name.
As a side effect of this function, if the attribute is found, it will be removed from tag.attributes because almost always that is the desired behavior. tag.parse_attributes() can be called for the tag if needed for future needs, i.e. when in an end tag and needing the attributes for a start tag.
- Parameters:
attribute_name (param) – The name of the attribute to get.
- property is_include¶
Whether the Django template tag is include.
- property can_be_void¶
Whether the tag can be a void element.
- property component_name¶
Legacy property for tag_name. Deprecated.