σ •abc@`sddlmZmZmZddlmZddlZddlmZm Z ddl m Z m Z m Z ddl mZmZmZddlmZmZdd lmZd je ƒd Zejd 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!`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 eZ eZ 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 < > & " ' 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 becomes . 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.
. space_before_trailing_solidus=True|False Places a space immediately before the closing slash in a tag using a trailing solidus. E.g.
. 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`s$|jr|j|jdƒS|SdS(Nuhtmlentityreplace(R2tencode(RBtstring((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/serializer.pyRG¨s cC`s$|jr|j|jdƒS|SdS(Nustrict(R2RG(RBRH((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Αddl m}||ƒ}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"d d&ƒ}|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 u CharactersuSpaceCharactersudatauuCommentu--uComment contains --u uEntityu;uEntity %s not recognizedu&%s;(u CharactersuSpaceCharacters(uStartTaguEmptyTag(,R2RR@tinject_meta_charsettfilters.inject_meta_charsetRJtalphabetical_attributestfilters.alphabeticalattributeststrip_whitespacetfilters.whitespacetsanitizetfilters.sanitizertomit_optional_tagstfilters.optionaltagstfindtserializeErrorRIRGRR 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_cdataRJttokenttypetdoctypeRctnamet_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(RBRgR2((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/serializer.pyR/?suXXX ERROR MESSAGE NEEDEDcC`s&|jj|ƒ|jr"t‚ndS(N(R@RRAtSerializeError(RBRs((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/serializer.pyRVEs (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[RcRR=RSRYRRdReRbRWRfRMRKRORQR8RFRGRIR^R6R/RV(((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/serializer.pyR.Qs4 8   ‰ RwcB`seZdZRS(uError in serialized tree(RxRyt__doc__(((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/serializer.pyRwLs(,t __future__RRRtpip._vendor.sixRtretcodecsRRt constantsRRRR R R RuR R txml.sax.saxutilsRR!t_quoteAttributeSpecCharstcompileR\R_RR9t_is_ucs4RvRXRpRqRRtislowerR,R^R6RR.t ExceptionRw(((sC/usr/lib/python2.7/site-packages/pip/_vendor/html5lib/serializer.pyts8       ϋ