o
    hN                     @   s*   d dl mZ d dlmZ G dd dZdS )    )List)Blockc                	   @   s   e Zd ZdZdZddedededdfd	d
ZdefddZdefddZ	e
deded  fddZe
deded  fddZdS )Commandz
    A Command represents an operation that has to be executed
    on a block for it to be converted into an arbitrary number
    of HTML nodes.
    nameindexdata r   r   r   returnNc                 C   s   || _ || _|| _d S Nr   )selfr   r   r    r   X/var/www/html/ndineBlogger/venv/lib/python3.10/site-packages/draftjs_exporter/command.py__init__   s   
zCommand.__init__c                 C   s   d| j  d| j d| j dS )Nz	<Command  >r   r   r   r   r   __str__   s   zCommand.__str__c                 C   s   t | S r   )strr   r   r   r   __repr__   s   zCommand.__repr__blockc                 C   sZ   g }| d D ]$}t |d }|d }||d  }|td|| |td|| q|S )u   
        Creates a list of commands from a block’s list of entity ranges.
        Each range is converted to two commands: a start_* and a stop_*.
        entityRangeskeyoffsetlengthstart_entitystop_entity)r   appendr   r   commandsrr   startstopr   r   r   from_entity_ranges   s   zCommand.from_entity_rangesc                 C   sV   g }| d D ]"}|d }|d }||d  }| td|| | td|| q|S )u   
        Creates a list of commands from a block’s list of style ranges.
        Each range is converted to two commands: a start_* and a stop_*.
        inlineStyleRangesstyler   r   start_inline_stylestop_inline_style)r   r   r   r   r   r   from_style_ranges+   s   zCommand.from_style_ranges)r	   )__name__
__module____qualname____doc__	__slots__r   intr   r   r   staticmethodr   r   r#   r(   r   r   r   r   r      s    r   N)typingr   draftjs_exporter.typesr   r   r   r   r   r   <module>   s    