
    ^h                        S SK r S SKrS SKJrJr  SSKJr  SSKJr  SSK	J
r
  SSKJr  \(       a  SSKJr  SS	KJr  S
\ R"                  SS4S jrS\S
\ R"                  SS4S jrSrSS jrS\\   4S jr\S:X  a  \" 5         gg)    N)TYPE_CHECKINGOptional   )__version__)create_markdown)MarkdownRenderer)RSTRenderer)BaseRenderer)Markdownargsreturnr   c                 
   U R                   (       a  U R                   nO/ SQnU R                  S:X  a  [        5       nO'U R                  S:X  a  [        5       nOU R                  n[	        U R
                  U R                  UUS9$ )N)strikethrough	footnotestablespeeduprstmarkdown)escape	hard_wraprendererplugins)pluginr   r	   r   r   r   hardwrap)r   r   r   s      J/home/james-whalen/.local/lib/python3.13/site-packages/mistune/__main__.py_mdr      sk    {{++ E}}#.=	*	$#%=={{--	     textc                     UR                   (       a1  [        UR                   S5       nUR                  U 5        S S S 5        g [        U 5        g ! , (       d  f       g = f)Nw)outputopenwriteprint)r   r   fs      r   _outputr&   $   s>    {{$++s#qGGDM $# 	d $#s   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            	      l   [         R                  " S[        [         R                  S9n U R	                  SSSS9  U R	                  SSS	S9  U R	                  S
SSSSSS9  U R	                  SSSS9  U R	                  SSSS9  U R	                  SSSS9  U R	                  SSSSS9  U R	                  SS S![
        -   S"9  U R                  5       nUR                  nU(       d  UR                  (       d
  [        5       nU(       a6  [        U5      nU" U5      n[        U[        5      (       d   e[        XA5        g UR                  (       aL  [        U5      nUR                  UR                  5      S#   n[        U[        5      (       d   e[        XA5        g [        S$5        [         R"                  " S%5        g )&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   ;   s   $$  <<F
 .  
 +  
 '   $  
 &  
 2  
 *	   IzG?STDllG499,Y'{$$$$$	Ywwtyy!!$$$$$$23r   c                      [         R                  R                  5       (       + n U (       a  [         R                  R                  5       $ g )N)rB   stdinisattyrA   )is_stdin_pipes    r   r>   r>   ~   s.    		((**Myy~~r   __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      s     
 * $  0 &""h   Z *# X// D @FHSM  zE r   