a
    t=ic                     @   s   d Z ddlZddlZddlZddlZddlZzddlmZ W nB e	y~   zddlm
Z W n e	yx   ddlm
Z Y n0 Y n0 ddlZddlmZmZmZ edZdddZd	d
 Zedkre  dS )a  
Python Markdown

A Python implementation of John Gruber's Markdown.

Documentation: https://python-markdown.github.io/
GitHub: https://github.com/Python-Markdown/markdown/
PyPI: https://pypi.org/project/Markdown/

Started by Manfred Stienstra (http://www.dwerg.net/).
Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org).
Currently maintained by Waylan Limberg (https://github.com/waylan),
Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser).

Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later)
Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b)
Copyright 2004 Manfred Stienstra (the original version)

License: BSD (see LICENSE.md for details).
    N)unsafe_load)load)DEBUGWARNINGCRITICALMARKDOWNc                 C   s  d}d}dt j }tj|||d}|jddddd	d
d |jddddd |jddddddd |jddddddd |jdd d!d"d#d$d% |jd&d'd(dd)d*d |jd+d,td-td. d/d0d1 |jd2d3d-td/d4d5 |jd6d-td/d7d5 || |\}} t	| d8krd}n| d8 }|j
s"g |_
i }|jrtj|jd9|jd:f}	zt|	}W nH ty }
 z.d;|j }|f|
jd<d  |
_ W Y d}
~
n
d}
~
0 0 W d   n1 s0    Y  ||j|j
||j|j|jd=}||jfS )>zE
    Define and parse `optparse` options for command-line usage.
    zN%prog [options] [INPUTFILE]
       (STDIN is assumed if no INPUTFILE is given)zUA Python implementation of John Gruber's Markdown. https://Python-Markdown.github.io/z	%%prog %s)usagedescriptionversionz-fz--filefilenameNz0Write output to OUTPUT_FILE. Defaults to STDOUT.ZOUTPUT_FILE)destdefaulthelpmetavarz-ez
--encodingencodingz$Encoding for input and output files.)r   r   z-oz--output_formatoutput_formatZxhtmlZOUTPUT_FORMATz.Use output format 'xhtml' (default) or 'html'.)r   r   r   r   z-nz--no_lazy_ollazy_olstore_falseTz.Observe number of first item of ordered lists.)r   actionr   r   z-xz--extensionappend
extensionszLoad extension EXTENSION.Z	EXTENSION)r   r   r   r   z-cz--extension_configs
configfileaq  Read extension configurations from CONFIG_FILE. CONFIG_FILE must be of JSON or YAML format. YAML format requires that a python YAML library be installed. The parsed JSON or YAML must result in a python dictionary which would be accepted by the 'extension_configs' keyword on the markdown.Markdown class. The extensions must also be loaded with the `--extension` option.ZCONFIG_FILEz-qz--quietstore_const
   verbosezSuppress all warnings.)r   r   constr   r   z-vz	--verbosezPrint all warnings.)r   r   r   r   z--noisyzPrint debug messages.r   r)moder   z(Failed parsing extension config file: %s   )inputoutputr   extension_configsr   r   r   )markdown__version__optparseOptionParser
add_optionr   r   r   
parse_argslenr   r   codecsopenr   	yaml_load	Exceptionargsr   r   r   r   )r-   valuesr   descverparseroptionsZ
input_filer!   fpemessageopts r7   b/home/droni/.local/share/virtualenvs/DPS-5Je3_V2c/lib/python3.9/site-packages/markdown/__main__.pyparse_options.   s    






8
r9   c                  C   sx   t  \} }| std t| t }t| |tkrdt	
d td td}|| tjf i |  dS )z#Run Markdown from the command line.   r   Tzpy.warningsN)r9   sysexitloggersetLevelloggingStreamHandler
addHandlerr   warningsfilterwarningscaptureWarnings	getLoggerr"   ZmarkdownFromFile)r2   Zlogging_levelZconsole_handlerZwarn_loggerr7   r7   r8   run   s    







rF   __main__)NN)__doc__r;   r$   r)   rB   r"   yamlr   r+   ImportErrorr   jsonr?   r   r   r   rE   r=   r9   rF   __name__r7   r7   r7   r8   <module>   s&   

Q