dj_angles.replacers.attributes ============================== .. py:module:: dj_angles.replacers.attributes .. autoapi-nested-parse:: Replace attributes like `
` with Django template tags. 1. Parses HTML into a tree structure 2. Groups conditional elements by their parent (siblings) 3. Chains siblings together (if → elif → else) 4. Generates output with proper {% if %}/{% endif %} wrapping Module Contents --------------- .. py:class:: ConditionalElement Represents an element with a dj-if/elif/else attribute. .. py:attribute:: type :type: str .. py:attribute:: condition :type: str .. py:attribute:: start_pos :type: int .. py:attribute:: end_pos :type: int .. py:attribute:: full_end_pos :type: int .. py:attribute:: original_tag :type: str .. py:attribute:: original_full :type: str .. py:attribute:: attr_match :type: re.Match .. py:attribute:: chain_id :type: int .. py:attribute:: next_in_chain :type: Optional[ConditionalElement] :value: None .. py:function:: replace_attributes(html: str) -> str Convert dj-if/elif/else attributes to Django template tags. :param html: The HTML string to process :param prefix: The attribute prefix (default "dj-"). If None, uses detailed configuration. :returns: HTML with Django template tags