Hacked By AnonymousFox

Current Path : /lib/python2.7/site-packages/pip/_vendor/html5lib/
Upload File :
Current File : //lib/python2.7/site-packages/pip/_vendor/html5lib/serializer.pyc

�
��abc@`sddlmZmZmZddlmZddlZddlmZm	Z	ddl
mZmZm
Z
ddl
mZmZmZddlmZmZdd	lmZd
je
�dZejded
�Zejded�ZiZed�dkZx�eej��D]�\Z Z!er<ee!�dkser[ee!�dkr[qne!dkree!�dkr�ej"e!�Z!ne#e!�Z!e!eks�e j$�r�e ee!<q�qqWd�Z%ede%�ddd�Z'de(fd��YZ)de*fd��YZ+dS(i(tabsolute_importtdivisiontunicode_literals(t	text_typeN(tregister_errortxmlcharrefreplace_errorsi(tvoidElementstbooleanAttributestspaceCharacters(trcdataElementstentitiestxmlEntities(ttreewalkerst_utils(tescapeuu"'=<>`u[u]u_	

 /`  ᠎᠏           

   ]u􏿿iu&c
C`st|ttf�rqg}g}t}x�t|j|j|j!�D]�\}}|rbt}qDn||j}tj	|j|t
|j|dg�!�r�tj|j||d!�}t}nt
|�}|j|�qDWxz|D]r}tj|�}	|	r<|jd�|j|	�|	jd�sW|jd�qWq�|jdt|�d�q�Wdj|�|jfSt|�SdS(Niu&u;u&#x%s;u(t
isinstancetUnicodeEncodeErrortUnicodeTranslateErrortFalset	enumeratetobjecttstarttendR
tisSurrogatePairtmintsurrogatePairToCodepointtTruetordtappendt_encode_entity_maptgettendswiththextjoinR(
texctrest
codepointstskiptitctindext	codepointtcpte((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/serializer.pythtmlentityreplace_errors*s0)
,	


uhtmlentityreplaceuetreecK`s1tj|�}t|�}|j||�|�S(N(Rt
getTreeWalkertHTMLSerializertrender(tinputttreetencodingtserializer_optstwalkerts((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/serializer.pyt	serializeJsR.cB`s�eZdZdZeZeZeZeZ	eZ
eZeZeZ
eZeZeZeZdZd�Zd�Zd�Zdd�Zdd�Zdd�ZRS(ulegacyu"uquote_attr_valuesu
quote_charuuse_best_quote_charuomit_optional_tagsuminimize_boolean_attributesuuse_trailing_solidususpace_before_trailing_solidusuescape_lt_in_attrsu
escape_rcdatauresolve_entitiesualphabetical_attributesuinject_meta_charsetustrip_whitespaceusanitizec	K`s�t|�t|j�}t|�dkrJtdtt|����nd|krbt|_nx6|jD]+}t|||j	|t
||���qlWg|_t|_dS(u6	Initialize HTMLSerializer.

        Keyword options (default given first unless specified) include:

        inject_meta_charset=True|False
          Whether it insert a meta element to define the character set of the
          document.
        quote_attr_values="legacy"|"spec"|"always"
          Whether to quote attribute values that don't require quoting
          per legacy browser behaviour, when required by the standard, or always.
        quote_char=u'"'|u"'"
          Use given quote character for attribute quoting. Default is to
          use double quote unless attribute value contains a double quote,
          in which case single quotes are used instead.
        escape_lt_in_attrs=False|True
          Whether to escape < in attribute values.
        escape_rcdata=False|True
          Whether to escape characters that need to be escaped within normal
          elements within rcdata elements such as style.
        resolve_entities=True|False
          Whether to resolve named character entities that appear in the
          source tree. The XML predefined entities &lt; &gt; &amp; &quot; &apos;
          are unaffected by this setting.
        strip_whitespace=False|True
          Whether to remove semantically meaningless whitespace. (This
          compresses all whitespace to a single space except within pre.)
        minimize_boolean_attributes=True|False
          Shortens boolean attributes to give just the attribute value,
          for example <input disabled="disabled"> becomes <input disabled>.
        use_trailing_solidus=False|True
          Includes a close-tag slash at the end of the start tag of void
          elements (empty elements whose end tag is forbidden). E.g. <hr/>.
        space_before_trailing_solidus=True|False
          Places a space immediately before the closing slash in a tag
          using a trailing solidus. E.g. <hr />. Requires use_trailing_solidus.
        sanitize=False|True
          Strip all unsafe or unknown constructs from output.
          See `html5lib user documentation`_
        omit_optional_tags=True|False
          Omit start/end tags that are optional.
        alphabetical_attributes=False|True
          Reorder attributes to be in alphabetical order.

        .. _html5lib user documentation: http://code.google.com/p/html5lib/wiki/UserDocumentation
        iu2__init__() got an unexpected keyword argument '%s'u
quote_charN(
t	frozensettoptionstlent	TypeErrortnexttiterRtuse_best_quote_chartsetattrRtgetattrterrorststrict(tselftkwargstunexpected_argstattr((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/serializer.pyt__init__ps.)	cC`s9t|t�st�|jr1|j|jd�S|SdS(Nuhtmlentityreplace(RRtAssertionErrorR2tencode(RBtstring((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/serializer.pyRH�s	cC`s9t|t�st�|jr1|j|jd�S|SdS(Nustrict(RRRGR2RH(RBRI((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/serializer.pytencodeStrict�s	cc`sn||_t}g|_|rI|jrIddlm}|||�}n|jrqddlm}||�}n|jr�ddl	m}||�}n|j
r�ddlm}||�}n|jr�ddl
m}||�}nx~|D]v}|d}|dkr�d|d}|dr9|d|d7}n|d	rP|d
7}n|d	r�|d	jd�dkr�|d	jd
�dkr�|jd�nd
}nd}|d||d	|f7}n|d7}|j|�Vq�|d3kra|dks|rF|r1|djd�dkr1|jd�n|j|d�Vqf|jt|d��Vq�|d4kr.|d}	|jd|	�V|	tkr�|jr�t}n|r�|jd�nx|dj�D]
\\}
}}|}
|}|jd�V|j|
�V|jsI|
tj|	t��kr�|
tjdt��kr�|jd�V|jdksxt|�dkr�t}nZ|jdkr�tj|�dk	}n3|jdkr�t j|�dk	}nt!d ��|j"d!d"�}|j#r|j"d#d$�}n|r�|j$}|j%rhd
|krDd|krDd}qhd|krhd
|krhd
}qhn|d
kr�|j"d
d%�}n|j"dd&�}|j|�V|j|�V|j|�Vq�|j|�Vq�q�W|	t&kr|j'r|j(r|jd'�Vq|jd(�Vn|jd�Vq�|d)kr�|d}	|	tkrYt}n|ro|jd�n|jd*|	�Vq�|d+kr�|d}|jd,�dkr�|jd-�n|jd.|d�Vq�|d/krU|d}	|	d0}|t)kr|jd1|	�n|j*r:|t+kr:t)|}n
d2|	}|j|�Vq�|j|d�q�WdS(5Ni(tFilterutypeuDoctypeu<!DOCTYPE %sunameupublicIdu PUBLIC "%s"usystemIdu SYSTEMu"iu'uASystem identifer contains both single and double quote charactersu %s%s%su>u
CharactersuSpaceCharactersudatau</uUnexpected </ in CDATAuStartTaguEmptyTagu<%su+Unexpected child element of a CDATA elementu uu=ualwaysuspeculegacyu?quote_attr_values must be one of: 'always', 'spec', or 'legacy'u&u&amp;u<u&lt;u&#39;u&quot;u /u/uEndTagu</%s>uCommentu--uComment contains --u	<!--%s-->uEntityu;uEntity %s not recognizedu&%s;(u
CharactersuSpaceCharacters(uStartTaguEmptyTag(,R2RR@tinject_meta_charsettfilters.inject_meta_charsetRKtalphabetical_attributestfilters.alphabeticalattributeststrip_whitespacetfilters.whitespacetsanitizetfilters.sanitizertomit_optional_tagstfilters.optionaltagstfindtserializeErrorRJRHRR	t
escape_rcdataRtitemstminimize_boolean_attributesRRttupletquote_attr_valuesR9t_quoteAttributeSpectsearchtNonet_quoteAttributeLegacyt
ValueErrortreplacetescape_lt_in_attrst
quote_charR=Rtuse_trailing_solidustspace_before_trailing_solidusR
tresolve_entitiesR(RBt
treewalkerR2tin_cdataRKttokenttypetdoctypeRdtnamet_t	attr_namet
attr_valuetktvt
quote_attrtdatatkey((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/serializer.pyR6�s�						





	

	#
!						
	




cC`sE|r%djt|j||���Sdjt|j|���SdS(Ntu(R!tlistR6(RBRhR2((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/serializer.pyR/?suXXX ERROR MESSAGE NEEDEDcC`s&|jj|�|jr"t�ndS(N(R@RRAtSerializeError(RBRt((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/serializer.pyRWEs	(uquote_attr_valuesu
quote_charuuse_best_quote_charuomit_optional_tagsuminimize_boolean_attributesuuse_trailing_solidususpace_before_trailing_solidusuescape_lt_in_attrsu
escape_rcdatauresolve_entitiesualphabetical_attributesuinject_meta_charsetustrip_whitespaceusanitizeN(t__name__t
__module__R\RdRR=RTRZRReRfRcRXRgRNRLRPRRR8RFRHRJR_R6R/RW(((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/serializer.pyR.Qs4	8		�RxcB`seZdZRS(uError in serialized tree(RyRzt__doc__(((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/serializer.pyRxLs(,t
__future__RRRtpip._vendor.sixRtretcodecsRRt	constantsRRRR	R
RRvRR
txml.sax.saxutilsRR!t_quoteAttributeSpecCharstcompileR]R`RR9t_is_ucs4RwRYRqRrRRtislowerR,R_R6RR.t	ExceptionRx(((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/serializer.pyt<module>s8

		
�

Hacked By AnonymousFox1.0, Coded By AnonymousFox