B
    ©‰AdR  ã               @   sR   d Z ddlZyddlmZ W n  ek
r<   ddlmZ Y nX G dd„ deƒZdS )z/
Created : 2021-07-30

@author: Eric Lapouyade
é    N)Úescapec               @   s0   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
S )ÚListingzØclass to manage \n and \a without to use RichText,
    by this way you keep the current template styling

    use {{ mylisting }} in your template and
    context={ mylisting:Listing(the_listing_with_newlines) }
    c             C   s*   t |tjtjfƒst |¡}t|ƒ| _d S )N)Ú
isinstanceÚsixÚ	text_typeÚbinary_typer   Úxml)ÚselfÚtext© r   úA/var/www/html/venv/lib/python3.7/site-packages/docxtpl/listing.pyÚ__init__   s    
zListing.__init__c             C   s   | j S )N)r   )r	   r   r   r   Ú__unicode__   s    zListing.__unicode__c             C   s   | j S )N)r   )r	   r   r   r   Ú__str__   s    zListing.__str__c             C   s   | j S )N)r   )r	   r   r   r   Ú__html__"   s    zListing.__html__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r   r      s
   r   )r   r   Úhtmlr   ÚImportErrorÚcgiÚobjectr   r   r   r   r   Ú<module>   s   