o
    i                     @   sb   d dl Z d dlZd dlmZ d dlmZ d dlmZ dd Zdd Z	d	d
 Z
edkr/e
  dS dS )    N)Console)RestructuredText)TerminalThemec                 C   s
   | ||fS )a  
    Function to represent color in RGB format.

    Parameters
    ----------
    r : int
        Red color value.
    g : int
        Green color value.
    b : int
        Blue color value.

    Returns
    -------
    tuple
        A tuple representing the RGB color.
     )rgbr   r   W/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/rich_rst/__main__.pyrgb   s   
r
   c                  C   s  t jdd} | jdddd | jddd	d
ddd | jdddtddd | jddtdddd | jddtdddd | jddd td!d"d | jd#d$td%d&d'd | jd(d)d*d
d&d+d | jd,d-d
d.d&d/d0 | jd1d2d
d3d&d4d0 | jd5d6td7d8d9d | jd:d;d
d<d&d=d0 |  S )>zParse command line arguments.z4Render reStructuredText to the console with rich-rst)descriptionpathPATHzpath to file, or - for stdin)metavarhelpz-cz--force-colorforce_color
store_trueNzforce color for non-terminals)destactiondefaultr   z-ez
--encodingencodingzutf-8z"encoding for file (default: utf-8))r   typer   r   z-wz--widthwidthz*width of output (default will auto-detect))r   r   r   r   z-hwz--html-width
html_width1675pxz&width of html output (default: 1675px)z-tz--code-theme
code_thememonokaizpygments code themez-htmlz--save-htmlhtml_filenameFzsave to htmlz-rz--wrap	word_wrapzword wrap long linesz-sz--soft-wrap	soft_wrapzenable soft wrapping mode)r   r   r   r   z-glz--guess-lexerguess_lexerzEWhether to guess the lexer for code blocks without specified languagez-dlz--default-lexerdefault_lexerpythonzbThe default lexer for code blocks without specified language if no lexer could be guessed or foundz-hez--hide-errorshide_errorszWhether to hide errors or not)argparseArgumentParseradd_argumentstrint
parse_args)parserr   r   r	   parse_arguments   s   r*   c                  C   sr  t  } ttdddtdddtdddtdddtdd	d
tdd	dtdddtdddtdddtdddgtdddtdddtdd	d
tdd	dtdddtdddtdddtdddg}d| j d}t| j| jt| jd}| j	dkrt
j n
t| j	d| jd }t|| j| j| j| j | j	dkr| j	ndd}|j|| jd | jr|j| j||d dS dS ) zThe main function.(   *   6            U   P      {                  y               z    <!DOCTYPE html>
    <head>
    <meta charset="UTF-8">
    <style>
    {stylesheet}
    body {
        color: {foreground};
        background-color: {background};
        max-width: a  
    }
    pre {
        white-space: pre-wrap;       /* Since CSS 2.1 */
        white-space: -moz-pre-wrap;  /* Mozilla, since 1999 */
        white-space: -pre-wrap;      /* Opera 4-6 */
        white-space: -o-pre-wrap;    /* Opera 7 */
        word-wrap: break-word;       /* Internet Explorer 5.5+ */
    }
    ::-moz-selection { /* Code for Firefox */
      background: #44475a;
    }
    ::selection {
      background: #44475a;
    }
    </style>
    </head>
    <html>
    <body>
        <code>
            <pre style="font-family:ui-monospace,'Fira Code',Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">{code}</pre>
        </code>
    </body>
    </html>
    )force_terminalr   record-rt)r   z<stdin>)r   r   r    show_errorsfilename)r   )themecode_formatN)r*   r   r
   r   r   r   r   boolr   r   sysstdinreadopenr   r   r   r   r    r"   printr   	save_html)argsDRACULA_TERMINAL_THEMECONSOLE_HTML_FORMATconsolecoderstr   r   r	   main,   sP   

















	"*rT   __main__)r#   rH   rich.consoler   rich_rstr   rich.terminal_themer   r
   r*   rT   __name__r   r   r   r	   <module>   s    K
