← Back
Editing: html.cpython-311.pyc
� �Ïc � � � d dl mc mZ d dlmZ d dlmZmZmZm Z ddl mZmZ dgZ G d� d� � Z G d� d e� � Zd edefd�Z e� � ZdS ) � N)� Formatter)�Any�List�Tuple�Union� )� FormattedText�StyleAndTextTuples�HTMLc �^ � e Zd ZdZdeddfd�Zdefd�Zdefd�Zde d e dd fd �Z de dd fd�ZdS )r a HTML formatted text. Take something HTML-like, for use as a formatted string. :: # Turn something into red. HTML('<style fg="ansired" bg="#00ff44">...</style>') # Italic, bold, underline and strike. HTML('<i>...</i>') HTML('<b>...</b>') HTML('<u>...</u>') HTML('<s>...</s>') All HTML elements become available as a "class" in the style sheet. E.g. ``<username>...</username>`` can be styled, by setting a style for ``username``. �value�returnNc �� ������� || _ t j d|� d�� � }g �g �g �g �dt f���fd��dt dd f������fd�� �|� � t �� � | _ d S )Nz<html-root>z</html-root>r c � �� g } �r+| � dd� �� � z � � �r| � d�d z � � �r| � d�d z � � d� | � � S )z$Build style string for current node.zclass:�,zfg:���zbg:� )�append�join)�parts�bg_stack�fg_stack� name_stacks ����D/usr/lib/python3/dist-packages/prompt_toolkit/formatted_text/html.py�get_current_stylez(HTML.__init__.<locals>.get_current_style( s� �� ��E�� >����X�����(<�(<�<�=�=�=�� 3����U�X�b�\�1�2�2�2�� 3����U�X�b�\�1�2�2�2��8�8�E�?�?�"� �nodec � �� | j D �]9}|j |j k r%�� � � � |j f� � �8|j dv}dx}}|j � � � D ]\ }}|dk r|}|dk r|}|dk r|}�d|v rt d� � �d|v rt d� � �|r� � |j � � |r�� |� � |r�� |� � �|� � |r� � � � |r�� � � |r�� � � ��;d S ) zProcess node recursively.)z #documentz html-root�style� �fg�bg�colorr z "fg" attribute contains a space.z "bg" attribute contains a space.N) � childNodes�nodeType� TEXT_NODEr �data�nodeName� attributes�items� ValueError�pop) r �child�add_to_name_stackr! r"