HEX
Server: LiteSpeed
System: Linux srv146.niagahoster.com 4.18.0-553.30.1.lve.el8.x86_64 #1 SMP Tue Dec 3 01:21:19 UTC 2024 x86_64
User: kodi1989 (1633)
PHP: 8.1.34
Disabled: symlink,shell_exec,exec,popen,system,dl,passthru,escapeshellarg,escapeshellcmd,show_source,pcntl_exec
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/markdown_it/cli/__pycache__/parse.cpython-37.pyc
B

��fU�@s�dZddlmZddlZddlmZmZddlZddlm	Z	ddl
mZd�e	�Z
d dd	d
�dd�Zd
dd�dd�Zddd�dd�Zdd�dd�Zddd
�dd�Zdd�dd�Zedkr�eejdd��Ze�e�dS)!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__)�
MarkdownItzmarkdown-it-py [version {}]zSequence[str] | None�int)�args�returncCs$t|�}|jrt|j�nt�dS)Nr)�
parse_args�	filenames�convert�interactive)r�	namespace�r�F/opt/alt/python37/lib/python3.7/site-packages/markdown_it/cli/parse.py�mains
rz
Iterable[str]�None)rr	cCsx|D]}t|�qWdS)N)�convert_file)r�filenamerrrrs
r�str)rr	c	Csty<t|dddd��"}t��|���}t|dd�WdQRXWn2tk
rntj�d|�d	��t�	d
�YnXdS)z>
    Parse a Markdown file and dump the output to stdout.
    �r�utf8�ignore)�encoding�errors�)�endNzCannot open file "z".
�)
�openr�render�read�print�OSError�sys�stderr�write�exit)rZfin�renderedrrrr!sr)r	c
Cs�t�g}d}x�y&|rdnd\}}|�t|�d�Wqtk
rptdt��d�|��dd�d}g}Yqtk
r�td�PYqXqWdS)	zT
    Parse user input, dump to stdout, rinse and repeat.
    Python REPL style.
    F)z... T)z>>> T�
r)rz	
Exiting.N)	�
print_heading�append�input�EOFErrorr!rr�join�KeyboardInterrupt)�contentsZmore�promptrrrr
.sr
zargparse.NamespacecCsFtjddt�d�tjd�}|jdddtd�|jd	d
dd�|�|�S)
zParse 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)�actionr4r�*z,specify an optional list of files to convert)�nargs�help)�argparse�ArgumentParserr�RawDescriptionHelpFormatter�add_argument�version_strr
)r�parserrrrr
Cs

r
cCstd�t��td�dS)Nz{} (interactive)z1Type Ctrl-D to complete input, or Ctrl-C to exit.)r!�formatr=rrrrr)fsr)�__main__r)N)�__doc__�
__future__rr9�collections.abcrrr#Zmarkdown_itrZmarkdown_it.mainrr?r=rrrr
r
r)�__name__�argvZ	exit_coder&rrrr�<module>s 
	
#