dj_angles.tags
==============
.. py:module:: dj_angles.tags
Module Contents
---------------
.. py:class:: Tag(tag_map: dj_angles.mappers.mapper.TagMap, html: str, tag_name: str, template_tag_args: str, tag_queue: Optional[collections.deque] = None)
Encapsulates metadata and functionality for a tag that will be processed by `dj-angles`.
.. py:attribute:: tag_name
:type: str
The portion of the tag's element name after the initial identifier (which defaults to 'dj-').
.. rubric:: Examples
- 'include' for ''
- 'partial' for ''
.. py:attribute:: html
:type: str
The original HTML of the tag.
.. py:attribute:: attributes
:type: dj_angles.attributes.Attributes
The parsed attributes of the template tag.
.. py:attribute:: is_shadow
:type: bool
:value: False
Whether or not the tag should use the Shadow DOM.
.. py:attribute:: is_end
:type: bool
:value: False
Whether or not the tag is an end tag, i.e. starts with ''.
.. py:attribute:: is_self_closing
:type: bool
:value: False
Whether or not the tag is self-closing, i.e. ends with '/>'.
.. py:attribute:: start_tag
:type: Optional[Tag]
:value: None
The associated start tag. Only set for end tags.
.. py:attribute:: django_template_tag
.. py:method:: parse_attributes()
Creates `Attributes` based on the template tag arguments.
.. py:method:: get_django_template_tag(slots: Optional[list[tuple[str, minestrone.Element]]] = None) -> str
Generate the Django template tag.
:param param slots: List of slots which is a tuple of slot name and inner html.
.. py:method:: get_wrapping_tag_name(name: Optional[str] = None) -> str
Get the wrapping tag name.
:param param name: The name for the wrapping tag.
.. py:method:: 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.
:param param attribute_name: The name of the attribute to get.
.. py:property:: is_include
Whether the Django template tag is `include`.
.. py:property:: component_name
Legacy property for `tag_name`. Deprecated.