o
     hA                     @  s   d Z ddlmZ ddlZddlmZmZ ddlZddlm	Z	 ddl
mZ de	 dZd!d"ddZd#ddZd$ddZd%ddZd&ddZd%ddZedkr]eejd d Zee dS dS )'zo
CLI interface to markdown-it-py

Parse one or more markdown files, convert each to HTML, and print to stdout.
    )annotationsN)IterableSequence)__version__)
MarkdownItzmarkdown-it-py [version ]argsSequence[str] | Nonereturnintc                 C  s&   t | }|jrt|j dS t  dS )Nr   )
parse_args	filenamesconvertinteractive)r   	namespace r   W/var/www/html/pro-man-master/venv/lib/python3.10/site-packages/markdown_it/cli/parse.pymain   s   
r   r   Iterable[str]Nonec                 C  s   | D ]}t | qd S N)convert_file)r   filenamer   r   r   r      s   
r   r   strc                 C  s   z*t | ddd}t | }t|dd W d   W dS 1 s#w   Y  W dS  tyC   tjd|  d t	d	 Y dS w )
z>
    Parse a Markdown file and dump the output to stdout.
    utf8ignore)encodingerrors endNzCannot open file "z".
   )
openr   renderreadprintOSErrorsysstderrwriteexit)r   finrenderedr   r   r   r   "   s   &r   c               
   C  s   t   g } d}	 z|rdnd\}}| t|d  W n) ty7   tdt d|  dd d}g } Y n tyD   td Y d	S w q)
zT
    Parse user input, dump to stdout, rinse and repeat.
    Python REPL style.
    FT)z... T)z>>> T
r   r   z	
Exiting.N)	print_headingappendinputEOFErrorr%   r   r#   joinKeyboardInterrupt)contentsmorepromptr   r   r   r   /   s    r   argparse.Namespacec                 C  sF   t jddt dt jd}|jdddtd |jd	d
dd || S )zParse input CLI arguments.zKParse one or more markdown files, convert each to HTML, and print to stdoutz9
Interactive:

  $ markdown-it
  markdown-it-py [version a  ] (interactive)
  Type Ctrl-D to complete input, or Ctrl-C to exit.
  >>> # Example
  ... > markdown *input*
  ...
  <h1>Example</h1>
  <blockquote>
  <p>markdown <em>input</em></p>
  </blockquote>

Batch:

  $ markdown-it README.md README.footer.md > index.html
)descriptionepilogformatter_classz-vz	--versionversion)actionr;   r   *z,specify an optional list of files to convert)nargshelp)argparseArgumentParserr   RawDescriptionHelpFormatteradd_argumentversion_strr   )r   parserr   r   r   r   D   s   
r   c                   C  s   t t d t d d S )Nz (interactive)z1Type Ctrl-D to complete input, or Ctrl-C to exit.)r%   rD   r   r   r   r   r.   g   s   r.   __main__r!   r   )r   r	   r
   r   )r   r   r
   r   )r   r   r
   r   )r
   r   )r   r	   r
   r7   )__doc__
__future__r   r@   collections.abcr   r   r'   markdown_itr   markdown_it.mainr   rD   r   r   r   r   r   r.   __name__argv	exit_coder*   r   r   r   r   <module>   s$   
	



#