
    g                        d Z ddlZddlZddlZddlZddlmZ ddlZddlm	Z	m
Z
mZmZ ddlmZ ddlmZ ddlmZ  G d	 d
ej&                        Z G d dej*                        Z edd      Zej1                  dd       ej1                  dd       ej1                  ddd       ej1                  ddddd       ej1                  ddd        ej1                  d!d"d#       ej1                  d$d%dd&d'       ej1                  d(d)       ej1                  d*ed+,       ej1                  d-d.       ej1                  d/d0d12       ej1                  d3d0d42       ej1                  d5d0d62       ej1                  d7d8d0d92       ej1                  d:d0d;2       ej1                  d<d0d=2       ej1                  d>d?ed@A       ej1                  dBd0dC2       ej1                  dDd0dE2       ej1                  dFdGdHdIJ       ej1                  dKdLedMA       ej1                  dNdOd0dP2       ej1                  dQdRd0dS2       ej1                  dTdUd0dV2       ej1                  dWdXdYe dZ[       ej1                  d\d]edd^_       ej1                  d`daedbA        ej4                  dfi e	 ddde
fdcZexj                   ddej8                  z   z  c_         edek(  r e        yy)gz%Command-line interface to WeasyPrint.    N)partial   )DEFAULT_OPTIONSHTMLLOGGER__version__)VARIANTS)pango)default_url_fetcherc                       e Zd Zd Zy)	PrintInfoc                     t        j                         }t        d|j                         t        d|j                         t        d|j
                         t        d|j                         t                t        dt               t        dt        j
                  j                         d          t        dt        j                         t        d	t        j                                t        j                          y )
NzSystem:zMachine:zVersion:zRelease:zWeasyPrint version:zPython version:r   zPydyf version:zPango version:)platformunameprintsystemmachineversionreleaser   syssplitpydyfr
   pango_versionexit)___r   s      k/home/viktor/gitlab-persoonlijk/factuur-applicatie/venv/lib/python3.12/site-packages/weasyprint/__main__.py__call__zPrintInfo.__call__   s     i&j%--(j%--(j%--(#[1!2!2!4Q!78 1 12 3 3 56
    N)__name__
__module____qualname__r    r   r   r   r      s    r   r   c                   8     e Zd Z fdZ fdZed        Z xZS )Parserc                 2    i | _         t        |   |i | y )N)
_argumentssuper__init__)selfargskwargs	__class__s      r   r)   zParser.__init__!   s    $)&)r   c                     t        |   |i | |d   j                  d      }||d<   |d   d   dk7  |d<   || j                  |<   y )N-flagsr   
positional)r(   add_argumentlstripr'   )r*   r+   r,   keyr-   s       r   r3   zParser.add_argument%   sU    d-f-2hooc"w#Bx{c1|%r   c                    | j                   j                  d      | j                   d<   g }| j                   j                         D ]  \  }}|j                  d       |j	                  dd      }|d   D ]B  }|j                  |       |d   s|dv r|j                  d| d	       |j                  d
       D d|d<   |j                  d|d   d   j                          |d   dd   d       d|v r)d
j                  |d         }|j                  d| d       |dk(  s|j                  d        dj                  |      S )Nhelpz.. option:: actionstorer1   r2   )r9   appendz <>z, 

r/   z  r   r   z.

choicesz  Possible choices: r:   z-  This option can be passed multiple times.

 )r'   popitemsr:   getupperjoin)r*   datar5   r+   r8   flagr=   s          r   	docstringzParser.docstring,   sH   "&//"5"5f"=..0 	OICKK'XXh0FW "D!L)f8K.KKK"SE,D!	"
 DHKK"T&\!_2245d6l126F5GuMND ))DO427)5AB!MN	O wwt}r   )r    r!   r"   r)   r3   propertyrF   __classcell__)r-   s   @r   r%   r%       s!    *&  r   r%   
weasyprintzRender web pages to PDF.)progdescriptioninputz1URL or filename of the HTML input, or - for stdin)r7   outputz1filename where output is written, or - for stdoutz-ez
--encodingz"force the input character encodingz-sz--stylesheetr:   stylesheetsz)URL or filename for a user CSS stylesheet)r8   destr7   z-mz--media-typez/media type to use for @media, defaults to printz-uz
--base-urluz   base for relative URLs in the HTML input, defaults to the input’s own filename or URL or the current directory for stdinz-az--attachmentattachmentsz7URL or filename of a file to attach to the PDF documentz--pdf-identifierzPDF file identifierz--pdf-variantzPDF variant to generate)r=   r7   z--pdf-versionzPDF version numberz--pdf-forms
store_truezinclude PDF forms)r8   r7   z--uncompressed-pdfz9do not compress PDF content, mainly for debugging purposez--custom-metadataz-include custom HTML meta tags in PDF metadataz-pz--presentational-hintsz follow HTML presentational hintsz--srgbzinclude sRGB color profilez--optimize-imagesz5optimize size of embedded images with no quality lossz-jz--jpeg-qualityz+JPEG quality between 0 (worst) to 95 (best))typer7   z--full-fontsz)embed unmodified font files when possiblez	--hintingz*keep hinting information in embedded fontsz-cz--cache-foldercachezistore cache on disk instead of memory, folder is created if needed and cleaned after the PDF is generated)rO   r7   z-Dz--dpiz4set maximum resolution of images embedded in the PDFz-vz	--verbosez&show warnings and information messagesz-dz--debugzshow debugging messagesz-qz--quietzhide logging messagesz	--versionr   zWeasyPrint version u,   print WeasyPrint’s version number and exit)r8   r   r7   z-iz--infoz!print system information and exit)r8   nargsr7   z-tz	--timeoutz(Set timeout in seconds for HTTP requestsc                    t         j                  |       }|j                  dk(  rI|xs t        j                  j
                  }|j                  d|_        n#|j                  dk(  rd|_        n|j                  }|j                  dk(  r|xs t        j                  j
                  }n|j                  }t        }|j                  t        t        |j                        }t        |      j                         D 	ci c]  \  }}	|t        v s||	 }
}}	|j                  r$t!        j"                  t$        j&                         n/|j(                  r#t!        j"                  t$        j*                         |j,                  s~t%        j.                         }|j                  r%|j1                  t%        j2                  d             n$|j1                  t%        j2                  d             t!        j4                  |        |||j                  |j6                  |j8                  |      } |j:                  |fi |
 yc c}	}w )	zThe ``weasyprint`` program takes at least two arguments:

    .. code-block:: sh

        weasyprint [options] <input> <output>

    r0   N.r>   )timeoutzB%(levelname)s: %(filename)s:%(lineno)d (%(funcName)s): %(message)sz%(levelname)s: %(message)s)base_urlencoding
media_typeurl_fetcher)PARSER
parse_argsrL   r   stdinbufferrX   rM   stdoutr   rW   r   varsr@   r   debugr   setLevelloggingDEBUGverboseINFOquietStreamHandlersetFormatter	Formatter
addHandlerrY   rZ   	write_pdf)argvr`   r^   r   r+   sourcerM   r[   r5   valueoptionshandlerhtmls                r   mainrt      s    T"DzzS*#))**== DM]]b  DM{{c,3::,,%K||14<<H &*$Z%5%5%7S!sE3/;QU
SG S zz&	%::'')::  !!234
   !2!23O!PQ'"??=D DNN6%W%/Ss   =H>H>r<   __main__r#   )__doc__argparserd   r   r   	functoolsr   r   r>   r   r   r   r   pdfr	   text.ffir
   urlsr   Actionr   ArgumentParserr%   r\   r3   intset_defaultsrt   rF   r    r#   r   r   <module>r      s   +    
   8 8   % X$$ D 
\/I	J   E  G   F  H   ,A  C   .	4  6   .	:  <   ,
G  H   .	B  D   &-B  C   X,E  G   O*>  ?   ,-@  B   	D  F   	8  :   
"<	+  -   \	%  '   	@  B   
	6  8   <	4  6   	5  7   

?  @   '	?  A   +l	1  3   )L/H  J   )L/F  H   	!+/	7  9   (9A	,  .   +C	3  5    &o & 4t$ 3&l ))) ) zF r   