Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 0øªjÍWã @sždZddlZddlmZddlmZmZddlmZm Z m Z m Z ddl m Z dd lmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)iZ*Gd d „d ƒZ+d d „Z,e,dƒe,dƒe,dƒe,dƒe,dƒe,dƒdd„ƒƒƒƒƒƒZ-e,dƒdd„ƒZ.dd„Z/e,dƒe/ddddd �d!d"„ƒƒZ0e,d#ƒd$d%„ƒZ1e,d&ƒe,d'ƒe,d(ƒe,d)ƒe,d*ƒe,d+ƒe/d,d-d.ƒd/d0„ƒƒƒƒƒƒƒZ2e,d1ƒd2d3„ƒZ3e,d4ƒd5d6„ƒZ4e,d7ƒe,d8ƒd9d:„ƒƒZ5e,d;ƒdƒe/d?d@ƒdAdB„ƒƒZ7e,dCƒe/dDdEdFdGdHdƒdIdJ„ƒƒZ8e,dKƒe/d.dLdMdNdOdPdQƒdRdS„ƒƒZ9e,dTƒdUdV„ƒZ:e,dWƒdXdY„ƒZ;e,dZƒd[d\„ƒZdS)cz` weasyprint.css.expanders ------------------------ Validate properties expanders. éN)Ú parse_coloré)ÚINITIAL_VALUESÚ Dimension)Ú InvalidValuesÚ get_keywordÚget_single_keywordÚsplit_on_commaé)Úexpand_font_variant)Úbackground_attachmentÚbackground_imageÚbackground_positionÚbackground_repeatÚbackground_sizeÚblock_ellipsisÚ border_styleÚ border_widthÚboxÚ column_countÚ column_widthÚ flex_basisÚflex_directionÚflex_grow_shrinkÚ flex_wrapÚ font_familyÚ font_sizeÚ font_stretchÚ font_styleÚ font_weightÚ line_heightÚlist_style_imageÚlist_style_positionÚlist_style_typeÚ other_colorsÚ overflow_wrapÚtext_align_allÚvalidate_non_shorthandc@seZdZdZdZdS)Ú AutoFakeTokenÚidentÚautoN)Ú__name__Ú __module__Ú __qualname__ÚtypeZ lower_value©r/r/úI/tmp/pip-build-_d5lkt3n/weasyprint/weasyprint/css/validation/expanders.pyr(sr(cs‡fdd„}|S)z1Decorator adding a function to the ``EXPANDERS``.csˆtkstˆƒ‚|tˆ<|S)z&Add ``function`` to the ``EXPANDERS``.)Ú EXPANDERSÚAssertionError)Úfunction)Ú property_namer/r0Úexpander_decorator$sz$expander..expander_decoratorr/)r4r5r/)r4r0Úexpander"s r6z border-colorz border-stylez border-widthÚmarginÚpaddingZbleedccsÔt|ƒdkr|d9}nPt|ƒdkr,|d9}n:t|ƒdkrH||df7}nt|ƒdkrftdt|ƒ›�ƒ‚xhtd|ƒD]Z\}}|jd ƒ}|dkr–||}n|d |…|||d …}t|||gd d �\}|VqrWd S)z>Expand properties setting a token for the four sides of a box.r éréz%Expected 1 to 4 token components got ú-topú-rightú-bottomú-leftú-NT)Úrequired)r;r<r=r>éÿÿÿÿ)ÚlenrÚzipÚrfindr')Úbase_urlÚnameÚtokensÚsuffixÚtokenÚiÚnew_nameÚresultr/r/r0Úexpand_four_sides,s"        rMz border-radiusc cs:g}}g}xX|D]P}|jdkrX|jdkrX||krN||dkrHtdƒ‚qV|}qbtdƒ‚q|j|ƒqW|sv|dd…}xv||fD]j}t|ƒdkrš|d9}q€t|ƒdkr°|d9}q€t|ƒd krÌ|j|dƒq€t|ƒdkr€td t|ƒ›�ƒ‚q€Wd}xBt|t||ƒƒD].\} }d| ›d�} t|| |dd�\} | V�qWdS)z-Validator for the ``border-radius`` property.Úliteralú/r z"Expected value after "/" separatorzExpected only one "/" separatorNr9rr:z%Expected 1 to 4 token components got útop-leftú top-rightú bottom-rightú bottom-leftzborder-z-radiusT)r@rA)rPrQrRrS)r.ÚvaluerÚappendrBrCr') rErFrGÚcurrentZ horizontalZverticalrIÚvaluesZcornersZcornerrKrLr/r/r0Ú border_radiusMs8            rXcs(|jddƒ‰| st‚‡‡fdd„}|S)zöDecorator helping expanders to handle ``inherit`` and ``initial``. Wrap an expander so that it does not have to handle the 'inherit' and 'initial' cases, and can just yield name suffixes. Missing suffixes get the initial value. Úwants_base_urlFcstjˆƒ‡‡‡fdd„ƒ}|S)z"Decorate the ``wrapped`` expander.c 3søt|ƒ}|d kr"tjˆ|ƒ}d}nrd}i}ˆr<ˆ|||ƒ}n ˆ||ƒ}xL|D]D\}}|ˆksdt|ƒ‚||krˆtd|jdƒ›d|›d�ƒ‚|||<qLWx^ˆD]V}|jdƒr²||} n|} ||krâ||} |sæt|| | dd �\\} } nd} | | fVqšWd S) zWrap the expander.ÚinheritÚinitialTFz got multiple r?z values in a z shorthand)r@N)rZr[)rÚdictÚfromkeysr2rÚstripÚ startswithr') rErFrGÚkeywordÚresultsZskip_validationrLrKÚ new_tokenZactual_new_namerT)Úexpanded_namesrYÚwrappedr/r0Úgeneric_expander_wrapperƒs4      zVgeneric_expander..generic_expander_decorator..generic_expander_wrapper)Ú functoolsÚwraps)rdre)rcrY)rdr0Úgeneric_expander_decorator�s'z4generic_expander..generic_expander_decorator)Úpopr2)rcÚkwargsrhr/)rcrYr0Úgeneric_expandervs  *rkz list-stylez-typez -positionz-imageT)rYc csÒd}}d}x||D]t}t|ƒdkr0|d7}|}qt|g|ƒdk rJd}d}n0t|gƒdk r^d}nt|gƒdk rvd }d}nt‚||gfVqW| r¨|r¨d |gfV|d8}| rÆ|rÆd|gfV|d8}|rÎt‚dS) zxExpand the ``list-style`` shorthand property. See http://www.w3.org/TR/CSS21/generate.html#propdef-list-style FrÚnoner Nz-imageTz -positionz-type)rr!r"r#r) rFrGrEZtype_specifiedZimage_specifiedZ none_countrIZ none_tokenrHr/r/r0Úexpand_list_style®s2      rmZborderccs2x,dD]$}xt||||ƒD] }|VqWqWdS)zkExpand the ``border`` shorthand property. See http://www.w3.org/TR/CSS21/box.html#propdef-border ú-topú-rightú-bottomú-leftN)rnrorprq)Úexpand_border_side)rErFrGrHZnew_propr/r/r0Ú expand_borderÙs rsz border-topz border-rightz border-bottomz border-leftz column-ruleÚoutlinez-widthz-colorz-styleccs\xV|D]N}t|ƒdk rd}n,t|gƒdk r0d}nt|gƒdk rDd}nt‚||gfVqWdS)zsExpand the ``border-*`` shorthand properties. See http://www.w3.org/TR/CSS21/box.html#propdef-border-top Nz-colorz-widthz-style)rrrr)rFrGrIrHr/r/r0rrås  rrZ backgroundc #süddddddddg‰t|ƒ}|dkr@xˆD]}||fVq*Wd Sd‡‡fd d„ }tt|ƒƒ}|t|ƒdd�\}}tdd„|jƒDƒƒ}x<|D]4}||ƒ\} } x"| jƒD]\}} ||j| ƒq¦WqŒWx(|jƒD]\}} || d d d…fVqÎWd|fVd S)ztExpand the ``background`` shorthand property. See http://dev.w3.org/csswg/css3-background/#the-background Úbackground_colorr rr rrZbackground_clipZbackground_originr[rZNFc sji‰‡fdd„}|ddd…}�x|�r&|dtj|dd…ddd…ƒƒrV|dd…=q"|dd…}|r~|dt|ƒƒr~|jƒq"|dtj|ˆƒƒrš|jƒq"|dtj|ƒƒr´|jƒq"|dtj|ƒƒrÎ|jƒq"�xîdt|ƒ d…D]Ø}|| d…ddd…}tj|ƒ}|dk rä|d |ƒ�s"t‚|| d…=|�rº|dj d k�rº|dj d k�rºxddt|ƒ d…D]N}|| d…ddd…}t j|ƒ}|dk �rh|d|ƒ�s¨t‚|| d…=�qhWPqäW|dk �rÌq"|dt j|ƒƒ�r |jƒ|dd…}|dt j|ƒƒ�r|jƒq"|dt j|ƒƒq"t ‚q"Wˆjdtdƒ} x(ˆD] } | ˆk�r>t| dˆ| <�q>W| ˆfS) Ncs.|dkr dSd|›�}|ˆkr"t‚|ˆ|<dS)NFZ background_T)r)rFrT)rar/r0Úadds z3expand_background..parse_layer..addr ÚrepeatrÚcolorÚimageÚ attachmentr9r:ÚpositionrNrOÚsizeÚoriginZcliprurrAéþÿÿÿrAr~rA)r9r:rr rArArA)r:rrArArA)rZ single_valuer$rir r rBrr2r.rTrrrr) rGÚ final_layerrvrIÚnZn_tokensr{r|Z next_tokenrxrF)rEÚ properties)rar0Ú parse_layersh              z&expand_background..parse_layerT)rcss|]\}}||gfVqdS)Nr/)Ú.0ÚkÚvr/r/r0ú Usz$expand_background..r zbackground-color)r[rZ)FrA)rÚreversedr Únextr\ÚitemsrU) rErFrGr`r‚ZlayersrxZ last_layerraÚ_ZlayerrTrWr/)rEr�r0Úexpand_backgroundþs& D   r‹ztext-decorationc csÌtƒ}d}d}xl|D]d}t|ƒ}|dkr4|j|ƒq|dkrP|dk rJt‚qx|}qt|ƒ}|dkrft‚q|dk rtt‚q|}qWd|kršt|ƒd kr”t‚d}n|s¢d}d |fVd|p´dfVd|pÂdfVdS)z2Expand the ``text-decoration`` shorthand property.NrlÚ underlineÚoverlineú line-throughÚblinkÚsolidÚdoubleÚdottedÚdashedÚwavyr Útext_decoration_lineÚtext_decoration_colorZ currentColorÚtext_decoration_style)rlrŒr�rŽr�)r�r‘r’r“r”)ÚsetrrvrrrB) rErFrGr•r–r—rIr`rxr/r/r0Úexpand_text_decoration_s6    r™zpage-break-afterzpage-break-beforeccsHt|ƒ}|jddƒd}|d kr,||fVn|dkr@|dfVnt‚d S) z�Expand legacy ``page-break-before`` and ``page-break-after`` properties. See https://www.w3.org/TR/css-break-3/#page-break-properties r?r r*ÚleftÚrightÚavoidÚalwaysÚpageN)r*ršr›rœ)rÚsplitr)rErFrGr`rKr/r/r0Úexpand_page_break_before_after…s  r zpage-break-insideccs$t|ƒ}|dkrd|fVnt‚dS)zyExpand the legacy ``page-break-inside`` property. See https://www.w3.org/TR/css-break-3/#page-break-properties r*rœz break-insideN)r*rœ)rr)rErFrGr`r/r/r0Úexpand_page_break_inside—s r¡Úcolumnsz column-widthz column-countccsªd}t|ƒdkr.t|dƒdkr.|ddd…}xL|D]D}t|gƒdk rT|dkrTd}nt|gƒdk rhd}nt‚||gfVq4Wt|ƒdkr¦|dkr”dnd}|tƒgfVdS) z*Expand the ``columns`` shorthand property.Nrrr*r z column-widthz column-countrA)rBrrrrr()rFrGrIr/r/r0Úexpand_columns¥s  r£z font-variantz -alternatesz-capsz -east-asianz -ligaturesz-numericcCst|ƒS)zoExpand the ``font-variant`` shorthand property. https://www.w3.org/TR/css-fonts-3/#font-variant-prop )r )rFrGr/r/r0Ú font_variant¹s r¤Úfontz -variant-capsz-weightz-stretchz-sizez line-heightz-familyccsbt|ƒ}|dkrtdƒ‚tt|ƒƒ}xštdƒD]~}|jƒ}t|ƒd krHq.t|gƒd k r\d }n}t|dgƒ}t|dgƒ}|r |r d|fVd|fVPq Wt‚nRt|ƒdkr¶t|dgƒ}|r’d|fVqºt|dgƒ}|r°d|fVqºt‚nt‚dS)z"Expand the ``flex-flow`` property.rNr rzflex-directionz flex-wraprA)rBrrr)rErFrGZ sorted_tokensÚ directionÚwrapr/r/r0Úexpand_flex_flowJs$      r½z line-clampccsät|ƒdkrpt|ƒ}|dkr0d Vd VdVqà|djdkrj|djd k rjd|djfVdVdVqàt‚npt|ƒd krÜ|djdkrÖ|dj}t|dgƒ}|rÐ|d k rÐd|djfVdVd|fVqÚt‚qàt‚nt‚d S)z#Expand the ``line-clamp`` property.r rlÚ max_linesÚcontinuer*úblock-ellipsisrr¶NÚdiscardr)r¾rl)r¿r*)rÀrl)r¿rÁ)rÀr*)r¿rÁ)rBrr.r·rrrT)rErFrGr`r¾Zellipsisr/r/r0Úexpand_line_clampes,     rÂz text-alignccsnt|ƒdkrft|ƒ}|dkr t‚|dkr,dnt|ƒ}|dkr@t‚|dkrLdn|}d|fVd|fVnt‚dS)z#Expand the ``text-align`` property.r Nz justify-allZjustifyÚstartr&Ztext_align_last)rBrrr&)rErFrGr`Z align_allZ align_lastr/r/r0Úexpand_text_align„s   rÄ)?Ú__doc__rfZtinycss2.color3rr�rrÚutilsrrrr Z descriptorsr r r rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r1r(r6rMrXrkrmrsrrr‹r™r r¡r£r¤r±r²rºr½rÂrÄr/r/r/r0ÚsZ  x  )8*  a&   G.