
    wg                     h    d dl mZ d dlmZ d dlmZ  G d d          Z e            fdedefdZd	S )
    )DocumentInterface)DocumentRepositoryInterface)get_document_repositoryc                   4    e Zd ZdeddfdZdededz  fdZdS )FormatDocument
repositoryreturnNc                     || _         d S )Nr   )selfr   s     D/var/www/html/cms/application/usecases/formatters/format_document.py__init__zFormatDocument.__init__	   s    $    document_slugc                    | j                             |          }|sd S |j        }| j                             |          }|D ]w}|j        rLd}|j        r,|j                                        r|j        }nd|j         d}d|j         d| d|j         d}n|j        }|                    |j        |          }xt          ||j
                  S )N "z<a class="ref" onclick="(z)">z</a>)textname)r   getr   get_document_patternsmethodargisdigitreplacetagr   r   )r   r   documentdocument_textpatternspatternr   strings           r   __call__zFormatDocument.__call__   s    ?&&}55 	4 ?88GG 	G 	GG~ 
&; 5{**,, 5%k4GK444cgnccsccw|ccc )11'+vFFMM m(-HHHHr   )__name__
__module____qualname__r   r   strr   r#    r   r   r   r      sg        %#> %4 % % % %Ic I.?$.F I I I I I Ir   r   document_repositoryr	   c                 "    t          |           S )Nr   )r   )r)   s    r   get_format_documentr+   '   s    %89999r   N)domain.materials.documentr   domain.materials.repositoryr   ;infrastructure.persistence.repositories.document_repositoryr   r   r+   r(   r   r   <module>r/      s    7 7 7 7 7 7 C C C C C C     
I I I I I I I I> LcKbKdKd : :-H :iw : : : : : :r   