%PDF- %PDF-
Direktori : /lib/python3/dist-packages/markdown_it/cli/__pycache__/ |
Current File : //lib/python3/dist-packages/markdown_it/cli/__pycache__/parse.cpython-312.pyc |
� 'W�dU � � � d Z ddlmZ ddlZddlmZmZ ddlZddlm Z ddl mZ dj e � Z ddd�Zdd �Zdd �Zdd�Zdd�Zdd �Zedk( r( eej* dd � Z ej. e� yy)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 {}]c �r � t | � }|j rt |j � yt � y)Nr )� parse_args� filenames�convert�interactive)�args� namespaces �7/usr/lib/python3/dist-packages/markdown_it/cli/parse.py�mainr s2 � ��4� �I����� �#�#�$� � � �� c �( � | D ] }t |� � y �N)�convert_file)r �filenames r r r s � �� ���X��r c �D � t | ddd�� 5 }t � j |j � � }t |d�� ddd� y# 1 sw Y yxY w# t $ r; t j j d| � d �� t j d � Y yw xY w)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)r �fin�rendereds r r r ! s� � �� �(�C�&�� B� $�c�!�|�*�*�3�8�8�:�6�H��(��#� $� $� $�� � �� � ���-�h�Z�t�<�=�������s/ �A �5A�A �A�A �A �AB�Bc �, � t � g } d} |rdnd\ }}| j t |� dz � �(# t $ r= t dt � j dj | � � z d�� d}g } Y �Ft $ r t d� Y yw xY w) zT Parse user input, dump to stdout, rinse and repeat. Python REPL style. F)z... T)z>>> T� r r z Exiting.N) � print_heading�append�input�EOFErrorr# r r! �join�KeyboardInterrupt)�contents�more�prompts r r r . s� � � �O��H��D� � �-1�>�~�L�F�D��O�O�E�&�M�D�0�1� �� � ��$���,�,�T�Y�Y�x�-@�A�A�r�J��D��H� � ��,��� �s �&8 �AB�=B�Bc �� � t j ddt � d�t j �� }|j dddt �� |j d d d�� |j | � 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)�actionr: r �*z,specify an optional list of files to convert)�nargs�help)�argparse�ArgumentParserr �RawDescriptionHelpFormatter�add_argument�version_strr )r �parsers r r r C s � � � $� $�4�� '�-� (� �&