
    Mh                         d dl Z d dlZd dlmZmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ erddlmZ dd	lmZ d
e j        ddfdZded
e j        ddfdZdZddZdee         fdZedk    r e             dS dS )    N)TYPE_CHECKINGOptional   )__version__)create_markdown)MarkdownRenderer)RSTRenderer)BaseRenderer)Markdownargsreturnr   c                     | j         r| j         }ng d}| j        dk    rt                      }n!| j        dk    rt                      }n| j        }t	          | j        | j        ||          S )N)strikethrough	footnotestablespeeduprstmarkdown)escape	hard_wraprendererplugins)pluginr   r	   r   r   r   hardwrap)r   r   r   s      P/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/mistune/__main__.py_mdr      s    { E+ EDD}#.==	*	$	$#%%={-	       textc                     |j         rEt          |j         d          5 }|                    |            d d d            d S # 1 swxY w Y   d S t          |            d S )Nw)outputopenwriteprint)r   r   fs      r   _outputr&   $   s    { $+s## 	qGGDMMM	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	ds   A  AAa  Mistune, a sane and fast python markdown parser.

Here are some use cases of the command line tool:

    $ python -m mistune -m "Hi **Markdown**"
    <p>Hi <strong>Markdown</strong></p>

    $ python -m mistune -f README.md
    <p>...

    $ cat README.md | python -m mistune
    <p>...
c                     t          j        dt          t           j                  } |                     ddd           |                     ddd	           |                     d
ddddd           |                     ddd           |                     ddd           |                     ddd           |                     dddd           |                     dd d!t
          z   "           |                                 }|j        }|s|j        st                      }|rCt          |          } ||          }t          |t                    sJ t          ||           d S |j        rXt          |          }|                    |j                  d#         }t          |t                    sJ t          ||           d S t          d$           t!          j        d%           d S )&Nzpython -m mistune)progdescriptionformatter_classz-mz	--messagezthe markdown message to convert)helpz-fz--filezthe markdown file to convertz-pz--pluginNAMEextend+zspecifiy a plugin to use)metavaractionnargsr+   z--escape
store_truezturn on escape option)r0   r+   z
--hardwrapzturn on hardwrap optionz-oz--outputz#write the rendered result into filez-rz
--rendererhtmlzspecify the output renderer)defaultr+   z	--versionversionzmistune )r0   r5   r   z"You MUST specify a message or filer   )argparseArgumentParserCMD_HELPRawDescriptionHelpFormatteradd_argumentr5   
parse_argsmessagefile
read_stdinr   
isinstancestrr&   readr$   sysexit)parserr   r<   mdr   s        r   clirF   ;   sb   $  <  F
 .    
 +    
 '     $    
 &    
 2    
 *	     IzG?STTTDlG 49 ,, YYr'{{$$$$$$d	 YYwwty!!!$$$$$$$d2333r   c                      t           j                                         } | rt           j                                        S d S )N)rB   stdinisattyrA   )is_stdin_pipes    r   r>   r>   ~   s7    	((***M y~~tr   __main__)r   N)r6   rB   typingr   r    r   r5   r   renderers.markdownr   renderers.rstr	   corer
   r   r   	Namespacer   r@   r&   r8   rF   r>   __name__ r   r   <module>rT      sW    



 * * * * * * * * $ $ $ $ $ $       0 0 0 0 0 0 & & & & & & #""""""""""""h  Z    *# X/ D    @ @ @ @FHSM     zCEEEEE r   