
    dd2                        d Z ddlmZ ddlmZ 	 ddlmZ 	 ddlZdd	lmZ ej$                  d
k  r ed      d Z G d de      Zy# e$ rk ddlZddlZ G d dej                  ej                        Z ej                  d      xej                  d<   Z ej                         xe_        Zee_        Y w xY w# e$ rZ ed      edZ[ww xY w)aj  
A parser for CommonMark Markdown text using `recommonmark`__.

__ https://pypi.org/project/recommonmark/

.. important:: This module is provisional

   * The "recommonmark" package is unmaintained and deprecated.
     This wrapper module will be removed in a future Docutils version.

   * The API is not settled and may change with any minor Docutils version.
    )	Component)nodes)addnodesNc                       e Zd Zy)pending_xrefN)__name__
__module____qualname__     G/usr/lib/python3/dist-packages/docutils/parsers/recommonmark_wrapper.pyr   r   &   s    r   r   sphinx)CommonMarkParserz0.6.0z^The installed version of "recommonmark" is too old. Update with "pip install -U recommonmark".zeParsing "recommonmark" Markdown flavour requires the
  package https://pypi.org/project/recommonmark.c                 V    t        | t        j                  t        j                  f      S N)
isinstancer   literalliteral_block)nodes    r   
is_literalr   :   s    dU]]E,?,?@AAr   c                   6    e Zd ZdZdZ	 dZdZd Zd Zd Z	d Z
y	)
ParserzMarkDown parser based on recommonmark.

    This parser is provisional:
    the API is not settled and may change with any minor Docutils version.
    )recommonmark
commonmarkmarkdownmdzrecommonmark parser)parsersc                 ,    t        j                  |       S r   )r   get_transforms)selfs    r   r   zParser.get_transformsJ   s    ''--r   c                 `   t        |j                  d            D ][  \  }}t        |      |j                  j                  kD  s)|j
                  j                  d|dz   z        }|j                  |        y 	 t        j                  | ||       |j                  t        j                        D ]  }|j                  }d}|dz   t        |      k  s#t!        ||   t        j"                        r[t!        ||dz      t        j"                        r;t        j"                  ||   |j%                  |dz         z         ||<   |||   _        n|dz  }|dz   t        |      k  r |j                  t(              D ]  }d|d   vs|d   j                  d         |j                  t        j*                        D ]+  }d	|j,                  v s|d   j                  |d	          |d	= - |j                  j.                  s[|j                  t        j0                        D ]9  }|j
                  j3                  d
      }	|j&                  j5                  ||	       ; |j                  t6        j8                        D ]W  }|j                  d   }
d|
vr&t        j:                  |
j=                               |
d<   |j&                  j5                  ||
       Y y# t        $ rR}|j                  j                  r||j
                  j                  d|z        }|j                  |       Y d}~d}~ww xY w)z9Use the upstream parser and clean up afterwards.
        
z&Line %d exceeds the line-length-limit.   Nz2Parsing with "recommonmark" returned the error:
%sr   codeclasseslanguagezRaw content disabled.name)	enumeratesplitlensettingsline_length_limitreportererrorappendr   parse	Exception	tracebackfindallr   TextElementchildrenr   Textpopparentr   r   
attributesraw_enabledrawwarningreplacer   r   fully_normalize_nameastext)r    inputstringdocumentiliner.   errr   r5   r<   	references              r   r0   zParser.parseM   s    !!2!24!89 	GAt4y8,,>>> ))//<acBD&		#""4h? $$U%6%67 		D}}HAA#H%x{EJJ7"8AaC=%**="'**Xa[ac9J-J"KHQK)-HQK&FA A#H%		 $$Z0 	/DT)_,Y&&v.	/ $$U%8%89 	%DT__,Y&&tJ'78$	%   ,, ((3 3"++334KL##D'23
 $$X%:%:; 	1Da(IY&$)$>$>4=4D4D4F%H	&!KKi0	1O  	#  **	%%++ -FFI-J KEOOE""	#s   :K 	L-AL((L-c                      y)zyDummy function to prevent spurious warnings.

        cf. https://github.com/readthedocs/recommonmark/issues/177
        Nr   )r    r   s     r   visit_documentzParser.visit_document   s    
 	r   c                 t    | j                   j                  t        j                  |j                               y r   )current_noder/   r   r6   r   )r    mdnodes     r   
visit_textzParser.visit_text   s#      FNN!;<r   N)r   r	   r
   __doc__	supportedconfig_sectionconfig_section_dependenciesr   r0   rG   rK   r   r   r   r   r   >   s2    
 AI'*N"..:1x=r   r   )rL   docutilsr   r   r   r   ImportErrorsystypesInlineElementr   
ModuleTypemodulesSimpleNamespacer   recommonmark.parserr   __version__rD   r   r   r   r   r   <module>r[      s     )I4 ') H I 	I
BU= U=;  	)8u||U]]8%5U%5%5h%??CKKF!6!6!6!88FOh(H	)  
	; s)   A 
B: A-B76B7:C?	CC