
    Fh                         S r SSKrSSKrSSKrSSKrSSKJrJr  SSKJ	r	  SSK
Jr  SrSrSS	 jrS
 rS rS\l         " S S\5      rS rSqg)zUtility for calling pandoc    N)BytesIOTextIOWrapper)check_version   )ConversionExceptionz2.9.2z4.0.0c                 d   SSUSU/nU(       a  UR                  U5        [        5         [        R                  " U[        R                  [        R                  S9nUR                  U R                  5       5      u  px[        [        U5      US5      R                  5       n	U	R                  S5      $ )a   Convert an input string using pandoc.

Pandoc converts an input string `from` a format `to` a target format.

Parameters
----------
source : string
    Input string, assumed to be valid format `from`.
fmt : string
    The name of the input format (markdown, etc.)
to : string
    The name of the output format (html, etc.)

Returns
-------
out : unicode
    Output as returned by pandoc.

Raises
------
PandocMissing
    If pandoc is not installed.
Any error messages generated by pandoc are printed to stderr.

pandocz-fz-t)stdinstdoutreplace
)extendcheck_pandoc_version
subprocessPopenPIPEcommunicateencoder   r   readrstrip)
sourcefmtto
extra_argsencodingcmdpout_out_strs
             iC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\nbconvert/utils/pandoc.pyr	   r	      s    4 T3b
)C

:  	JOOJOOLA]]6==?+FCGCL(I>CCEG>>$    c                  t   [         c  [        R                  " S5      (       d
  [        5       e[        R
                  " SS/5      n U R                  5       n[        R                  " S5      nUS   R                  SS5      R                  5        H"  nUR                  U5      (       d  M  Uq   [         $    [         $ )aR  Gets the Pandoc version if Pandoc is installed.

If the minimal version is not met, it will probe Pandoc for its version, cache it and return that value.
If the minimal version is met, it will return the cached version and stop probing Pandoc
(unless `clean_cache()` is called).

Raises
------
PandocMissing
    If pandoc is unavailable.
r	   z-vz^\d+(\.\d+){1,}$r   asciir   )	__versionshutilwhichPandocMissingr   check_output
splitlinesrecompiledecodesplitmatch)r   	out_linesversion_patterntoks       r!   get_pandoc_versionr3   ;   s     ||H%%/!%%x&67NN$	**%89Q<&&w	:@@BC$$S))		 C r"   c                  J   [         R                  b  [         R                  $ [        5       n U c  [        R                  " S[
        SS9  g[        U [        [        S9nU[         l        U(       d4  [        R                  " SU -  S[        -  -   S[        -  -   S	-   [
        SS9  U$ )
z|Returns True if pandoc's version meets at least minimal version.

Raises
------
PandocMissing
    If pandoc is unavailable.
zSorry, we cannot determine the version of pandoc.
Please consider reporting this issue and include theoutput of pandoc --version.
Continuing...   )
stacklevelF)max_vz5You are using an unsupported version of pandoc (%s).
z#Your version must be at least (%s) zbut less than (%s).
zFRefer to https://pandoc.org/installing.html.
Continuing with doubts...)	r   _cachedr3   warningswarnRuntimeWarningr   _minimal_version_maximal_version)voks     r!   r   r   W   s     ##/#+++Ay9 	
 	q*2B	CB#% DqH36FFG%(889 XX 	
 Ir"   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )r(      z(Exception raised when Pandoc is missing.c                 $   > [         TU ]  S5        g)zInitialize the exception.z^Pandoc wasn't found.
Please check that pandoc is installed:
https://pandoc.org/installing.htmlN)super__init__)selfargskwargs	__class__s      r!   rD   PandocMissing.__init__   s    1	
r"    )__name__
__module____qualname____firstlineno____doc__rD   __static_attributes____classcell__)rH   s   @r!   r(   r(      s    2
 
r"   r(   c                      Sq g)zClean the internal cache.N)r%   rJ   r"   r!   clean_cacherS      s	     Ir"   )Nzutf-8)rO   r+   r&   r   r9   ior   r   nbconvert.utils.versionr   
exceptionsr   r<   r=   r	   r3   r   r8   r(   rS   r%   rJ   r"   r!   <module>rW      s`      
    % 1 +  % P8 F  $  	
' 	
 	r"   