a
    –¥»a:  ã                   @   s0   d dl mZ G dd„ deƒZG dd„ deƒZdS )é    )ÚParserc                   @   s„   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ ZdS ) Ú	Formatterc                 C   s
   d| _ d S )NÚ ©Úcontent©Úself© r	   úV/home/yuhw/wc/pochoir/venv/lib/python3.9/site-packages/caffe2/python/docs/formatter.pyÚ__init__   s    zFormatter.__init__c                 C   s   |   ¡ S ©N)Ú	__class__r   r	   r	   r
   Úclone   s    zFormatter.clonec                 C   s   | j S r   r   r   r	   r	   r
   Údump   s    zFormatter.dumpc                 C   s   t || ƒ ¡ }|  |¡ d S r   )r   ÚparseÚaddRaw©r   Útextr	   r	   r
   ÚparseAndAdd   s    zFormatter.parseAndAddc                 C   s   t dƒ‚d S ©NzNot yet implemented.©Ú	Exceptionr   r	   r	   r
   r      s    zFormatter.addRawc                 C   s   t dƒ‚d S r   r   r   r	   r	   r
   ÚaddLine   s    zFormatter.addLinec                 C   s   t dƒ‚d S r   r   r   r	   r	   r
   ÚaddLinebreak   s    zFormatter.addLinebreakc                 C   s   t dƒ‚d S r   r   r   r	   r	   r
   Ú	addHeader!   s    zFormatter.addHeaderc                 C   s   t dƒ‚d S r   r   r   r	   r	   r
   ÚaddEmphasis$   s    zFormatter.addEmphasisc                 C   s   t dƒ‚d S r   r   )r   ÚtextListr	   r	   r
   ÚaddList'   s    zFormatter.addListc                 C   s   t dƒ‚d S r   r   ©r   r   Úurlr	   r	   r
   ÚaddLink*   s    zFormatter.addLinkc                 C   s   t dƒ‚d S r   r   r   r	   r	   r
   ÚaddCode-   s    zFormatter.addCodec                 C   s   t dƒ‚d S r   r   r   r	   r	   r
   ÚaddCodeLink0   s    zFormatter.addCodeLinkc                 C   s   t dƒ‚d S r   r   )r   Útabler	   r	   r
   ÚaddTable3   s    zFormatter.addTablec                 C   s   t dƒ‚d S r   r   r   r	   r	   r
   ÚaddBreak6   s    zFormatter.addBreakN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r   r   r   r   r    r!   r"   r$   r%   r	   r	   r	   r
   r   
   s   r   c                   @   sp   e Zd Zdd„ Zddd„Zdd„ Zdd	d
„Zddd„Zdd„ Zdd„ Z	ddd„Z
ddd„Zddd„Zdd„ ZdS ) ÚMarkdownc                 C   s   |  j dj|d�7  _ d S )Nz{text}©r   ©r   Úformatr   r	   r	   r
   r   ;   s    zMarkdown.addRawFc                 C   s$   |  j dj|rdnd|d�7  _ d S )Nz{line}{text}
Ú
r   )Úliner   r+   )r   r   Únew_liner	   r	   r
   r   >   s    ÿzMarkdown.addLinec                 C   s   |  j d7  _ d S )Nr-   r   r   r	   r	   r
   r   B   s    zMarkdown.addLinebreaké   c                 C   s   |   dj|d |d�d¡ d S )Nz{header} {text}ú#)Úheaderr   T)r   r,   )r   r   Úhr	   r	   r
   r   E   s    zMarkdown.addHeaderc                 C   s   |   dj|d |d�¡ d S )Nz{stars}{text}{stars}Ú*)Zstarsr   ©r   r,   )r   r   Úsr	   r	   r
   r   H   s    zMarkdown.addEmphasisc                 C   s*   |D ]}|   dj|d�d¡ q|  ¡  d S )Nz- {text}r*   T)r   r,   r   )r   r   r   r	   r	   r
   r   K   s    zMarkdown.addListc                 C   s   |   dj||d�¡ d S )Nz[{text}]({url}))r   r   r5   r   r	   r	   r
   r    P   s    zMarkdown.addLinkNc                 C   s   |   dj|d�¡ d S )Nz({path}))Úpathr5   )r   r7   Úoptionsr	   r	   r
   r"   S   s    zMarkdown.addCodeLinkc                 C   s2   |r|  j dj|d�7  _ n|  dj|d�¡ d S )Nz`{text}`r*   z

```
{text}```

)r   r,   r   )r   r   Úinliner	   r	   r
   r!   V   s    zMarkdown.addCodec              	   C   s¦   |   ¡  t|ƒdksJ ‚|r>| ddd„ tt|d ƒƒD ƒ¡ |  d |d ¡¡ |  d dd„ tt|d ƒƒD ƒ¡¡ |dd … D ]}|  d |¡¡ q„|   ¡  d S )Nr0   r   c                 S   s   g | ]}d ‘qS )ú r	   ©Ú.0Úir	   r	   r
   Ú
<listcomp>`   ó    z%Markdown.addTable.<locals>.<listcomp>z | c                 S   s   g | ]}d ‘qS )z----r	   r;   r	   r	   r
   r>   b   r?   )r   ÚlenÚinsertÚranger   Újoin)r   r#   ZnoTitleÚrowr	   r	   r
   r$   \   s    "&zMarkdown.addTablec                 C   s   |   dd¡ d S )Nz
---
T)r   r   r	   r	   r
   r%   g   s    zMarkdown.addBreak)F)r0   )r0   )N)F)F)r&   r'   r(   r   r   r   r   r   r   r    r"   r!   r$   r%   r	   r	   r	   r
   r)   :   s   





r)   N)Zcaffe2.python.docs.parserr   Úobjectr   r)   r	   r	   r	   r
   Ú<module>   s   0