Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 Aøªj4ã @s ddlmZmZmZddlmZddlmZmZm Z ddddd d d d d g Z ej Z ej ZejZejZejZejZdZdje ƒZ Gdd „d eƒZGdd „d eƒZdS)é)Úabsolute_importÚdivisionÚunicode_literals)ÚNodeé)Ú namespacesÚ voidElementsÚspaceCharactersÚDOCUMENTÚDOCTYPEÚTEXTÚELEMENTÚCOMMENTÚENTITYÚUNKNOWNÚ TreeWalkerÚNonRecursiveTreeWalkerz <#UNKNOWN#>Úc@sleZdZdZdd„Zdd„Zdd„Zdd d „Zd d „Zd d„Z dd„Z dd„Z ddd„Z dd„Z dd„ZdS)rz}Walks a tree yielding tokens Tokens are dicts that all have a ``type`` field specifying the type of the token. cCs ||_dS)zCCreates a TreeWalker :arg tree: the tree to walk N)Útree)Úselfr©rú=/tmp/pip-build-_d5lkt3n/html5lib/html5lib/treewalkers/base.pyÚ__init__szTreeWalker.__init__cCst‚dS)N)ÚNotImplementedError)rrrrÚ__iter__#szTreeWalker.__iter__cCs d|dœS)z†Generates an error token with the given message :arg msg: the error message :returns: SerializeError token ÚSerializeError)ÚtypeÚdatar)rÚmsgrrrÚerror&szTreeWalker.errorFccs$d|||dœV|r |jdƒVdS)arGenerates an EmptyTag token :arg namespace: the namespace of the token--can be ``None`` :arg name: the name of the element :arg attrs: the attributes of the element as a dict :arg hasChildren: whether or not to yield a SerializationError because this tag shouldn't have children :returns: EmptyTag token ÚEmptyTag)rÚnameÚ namespacerzVoid element has childrenN)r)rr"r!ÚattrsÚ hasChildrenrrrÚemptyTag0s  zTreeWalker.emptyTagcCsd|||dœS)zôGenerates a StartTag token :arg namespace: the namespace of the token--can be ``None`` :arg name: the name of the element :arg attrs: the attributes of the element as a dict :returns: StartTag token ÚStartTag)rr!r"rr)rr"r!r#rrrÚstartTagEs zTreeWalker.startTagcCs d||dœS)z´Generates an EndTag token :arg namespace: the namespace of the token--can be ``None`` :arg name: the name of the element :returns: EndTag token ÚEndTag)rr!r"r)rr"r!rrrÚendTagVs zTreeWalker.endTagccsx|}|jtƒ}|dt|ƒt|ƒ…}|r6d|dœV|}|jtƒ}|t|ƒd…}|rdd|dœV|rtd|dœVdS)atGenerates SpaceCharacters and Characters tokens Depending on what's in the data, this generates one or more ``SpaceCharacters`` and ``Characters`` tokens. For example: >>> from html5lib.treewalkers.base import TreeWalker >>> # Give it an empty tree just so it instantiates >>> walker = TreeWalker([]) >>> list(walker.text('')) [] >>> list(walker.text(' ')) [{u'data': ' ', u'type': u'SpaceCharacters'}] >>> list(walker.text(' abc ')) # doctest: +NORMALIZE_WHITESPACE [{u'data': ' ', u'type': u'SpaceCharacters'}, {u'data': u'abc', u'type': u'Characters'}, {u'data': u' ', u'type': u'SpaceCharacters'}] :arg data: the text data :returns: one or more ``SpaceCharacters`` and ``Characters`` tokens NÚSpaceCharacters)rrÚ Characters)Úlstripr ÚlenÚrstrip)rrZmiddleÚleftÚrightrrrÚtextds    zTreeWalker.textcCs d|dœS)zdGenerates a Comment token :arg data: the comment :returns: Comment token ÚComment)rrr)rrrrrÚcommentŠszTreeWalker.commentNcCsd|||dœS)zŒGenerates a Doctype token :arg name: :arg publicId: :arg systemId: :returns: the Doctype token ÚDoctype)rr!ÚpublicIdÚsystemIdr)rr!r5r6rrrÚdoctype”s zTreeWalker.doctypecCs d|dœS)zjGenerates an Entity token :arg name: the entity name :returns: an Entity token ÚEntity)rr!r)rr!rrrÚentity¥szTreeWalker.entitycCs|jd|ƒS)zHandles unknown node typeszUnknown node type: )r)rZnodeTyperrrÚunknown¯szTreeWalker.unknown)F)NN)Ú__name__Ú __module__Ú __qualname__Ú__doc__rrrr%r'r)r1r3r7r9r:rrrrrs &  c@s4eZdZdd„Zdd„Zdd„Zdd„Zd d „Zd S) rcCst‚dS)N)r)rÚnoderrrÚgetNodeDetailsµsz%NonRecursiveTreeWalker.getNodeDetailscCst‚dS)N)r)rr?rrrÚ getFirstChild¸sz$NonRecursiveTreeWalker.getFirstChildcCst‚dS)N)r)rr?rrrÚgetNextSibling»sz%NonRecursiveTreeWalker.getNextSiblingcCst‚dS)N)r)rr?rrrÚ getParentNode¾sz$NonRecursiveTreeWalker.getParentNodec cs|j}�xú|dk �r|j|ƒ}|d|dd…}}d}|tkrN|j|ŽVnà|tkrrxÖ|j|ŽD] }|VqbWn¼|tkrØ|\}}}}| s˜|tdkrÆ|tkrÆx|j ||||ƒD] }|Vq²Wd}n|j |||ƒVnV|t krò|j |dƒVn<|t k�r|j|dƒVn |tk�rd}n|j|dƒV|�r@|j|ƒ} nd} | dk �rT| }q xª|dk �rþ|j|ƒ}|d|dd…}}|tk�rÂ|\}}}}|�rª|tdk�s´|tk�rÂ|j||ƒV|j|k�rÔd}P|j|ƒ} | dk �rð| }Pn |j|ƒ}�qVWq WdS)NréFÚhtmlT)rr@r r7r r1r rrr%r'rr3rr9r r:rAr)rBrC) rÚ currentNodeÚdetailsrr$Útokenr"r!Ú attributesZ firstChildZ nextSiblingrrrrÁsZ                 zNonRecursiveTreeWalker.__iter__N)r;r<r=r@rArBrCrrrrrr´s N)Ú __future__rrrÚxml.domrÚ constantsrrr Ú__all__Z DOCUMENT_NODEr ZDOCUMENT_TYPE_NODEr Z TEXT_NODEr Z ELEMENT_NODEr Z COMMENT_NODErZ ENTITY_NODErrÚjoinÚobjectrrrrrrÚs  !