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øªjÙ8ã@sòddlmZmZmZddlmZddlmZmZm Z dZ e eƒdfe ee ddfhBƒdfe ee dd fe dd fhBƒdfe e ddfe dd fgƒdfe e dd fe dd fgƒdfdœZ Gdd„de ƒZGdd„deƒZGdd„de ƒZdS)é)Úabsolute_importÚdivisionÚunicode_literals)Ú text_typeé)ÚscopingElementsÚtableInsertModeElementsÚ namespacesNFÚhtmlÚbuttonÚolÚulÚtableÚoptgroupÚoptionT)Nr ÚlistrÚselectc@sbeZdZdZdd„Zdd„Zdd„Zdd „Zdd d „Zd d„Z dd„Z dd„Z dd„Z dd„Z d S)ÚNodezRepresents an item in the treecCs(||_d|_d|_i|_g|_g|_dS)zRCreates a Node :arg name: The tag name associated with the node N)ÚnameÚparentÚvalueÚ attributesÚ childNodesÚ_flags)Úselfr©rú>/tmp/pip-build-_d5lkt3n/html5lib/html5lib/treebuilders/base.pyÚ__init__s z Node.__init__cCs:djdd„|jjƒDƒƒ}|r,d|j|fSd|jSdS)Nú cSsg|]\}}d||f‘qS)z%s="%s"r)Ú.0rrrrrú .sz Node.__str__..z<%s %s>z<%s>)ÚjoinrÚitemsr)rÚ attributesStrrrrÚ__str__-s  z Node.__str__cCs d|jS)Nz<%s>)r)rrrrÚ__repr__6sz Node.__repr__cCst‚dS)z[Insert node as a child of the current node :arg node: the node to insert N)ÚNotImplementedError)rÚnoderrrÚ appendChild9szNode.appendChildNcCst‚dS)aBInsert data as text in the current node, positioned before the start of node insertBefore or to the end of the node's text. :arg data: the data to insert :arg insertBefore: True if you want to insert the text before the node and False if you want to insert it after the node N)r&)rÚdataÚ insertBeforerrrÚ insertTextAs zNode.insertTextcCst‚dS)aInsert node as a child of the current node, before refNode in the list of child nodes. Raises ValueError if refNode is not a child of the current node :arg node: the node to insert :arg refNode: the child node to insert the node before N)r&)rr'ÚrefNoderrrr*Ms zNode.insertBeforecCst‚dS)zhRemove node from the children of the current node :arg node: the child node to remove N)r&)rr'rrrÚ removeChildYszNode.removeChildcCs$x|jD]}|j|ƒqWg|_dS)zôMove all the children of the current node to newParent. This is needed so that trees that don't store text as nodes move the text in the correct way :arg newParent: the node to move all this node's children to N)rr()rÚ newParentÚchildrrrÚreparentChildrenas zNode.reparentChildrencCst‚dS)zŠReturn a shallow copy of the current node i.e. a node with the same name and attributes but with no parent or child nodes N)r&)rrrrÚ cloneNodenszNode.cloneNodecCst‚dS)zFReturn true if the node has children or text, false otherwise N)r&)rrrrÚ hasContenttszNode.hasContent)N)Ú__name__Ú __module__Ú __qualname__Ú__doc__rr$r%r(r+r*r-r0r1r2rrrrrs    rc@seZdZdd„Zdd„ZdS)ÚActiveFormattingElementscCsfd}|tkrVxH|ddd…D]6}|tkr*P|j||ƒr>|d7}|dkr|j|ƒPqWtj||ƒdS)Nréééÿÿÿÿ)ÚMarkerÚ nodesEqualÚremoverÚappend)rr'Ú equalCountÚelementrrrr>{s  zActiveFormattingElements.appendcCs$|j|jksdS|j|jks dSdS)NFT)Ú nameTupler)rÚnode1Únode2rrrr<ˆs   z#ActiveFormattingElements.nodesEqualN)r3r4r5r>r<rrrrr7zs r7c@sÖeZdZdZdZdZdZdZdZdd„Z dd„Z d+dd„Z d d „Z d d „Z d d„Zdd„Zdd„Zd,dd„Zdd„Zdd„Zdd„ZeeeƒZdd„Zdd„Zd-dd „Zd!d"„Zd.d#d$„Zd%d&„Zd'd(„Zd)d*„ZdS)/Ú TreeBuilderaBase treebuilder implementation * documentClass - the class to use for the bottommost node of a document * elementClass - the class to use for HTML Elements * commentClass - the class to use for comments * doctypeClass - the class to use for doctypes NcCs|r d|_nd|_|jƒdS)zmCreate a TreeBuilder :arg namespaceHTMLElements: whether or not to namespace HTML elements zhttp://www.w3.org/1999/xhtmlN)ÚdefaultNamespaceÚreset)rÚnamespaceHTMLElementsrrrr¬szTreeBuilder.__init__cCs.g|_tƒ|_d|_d|_d|_|jƒ|_dS)NF)Ú openElementsr7ÚactiveFormattingElementsÚ headPointerÚ formPointerÚinsertFromTableÚ documentClassÚdocument)rrrrrF¸s zTreeBuilder.resetcCs”t|dƒ}|s2t|tƒr$td|f}t|tƒs2t‚t|\}}xHt|jƒD]:}|r^||kr^dS| rr|j |krrdS||j |kArJdSqJWds�t‚dS)NrAr TF) ÚhasattrÚ isinstancerr ÚtupleÚAssertionErrorÚlistElementsMapÚreversedrHrA)rÚtargetÚvariantÚ exactNodeÚ listElementsÚinvertr'rrrÚelementInScopeÄs     zTreeBuilder.elementInScopecCsÈ|js dSt|jƒd}|j|}|tks4||jkr8dSx6|tkrn||jkrn|dkrZd}P|d8}|j|}q:WxR|d7}|j|}|jƒ}|jd|j|j|jdœƒ}||j|<||jdkrrPqrWdS)Nr8rÚStartTag)ÚtyperÚ namespacer)r:r:) rIÚlenr;rHr1Ú insertElementrr]r)rÚiÚentryÚcloner@rrrÚ#reconstructActiveFormattingElementsÚs.    z/TreeBuilder.reconstructActiveFormattingElementscCs,|jjƒ}x|jr&|tkr&|jjƒ}q WdS)N)rIÚpopr;)rrarrrÚclearActiveFormattingElementss z)TreeBuilder.clearActiveFormattingElementscCs8x2|jddd…D]}|tkr"Pq|j|kr|SqWdS)zšCheck if an element exists between the end of the active formatting elements and the last marker. If it does, return it, else return falseNr8Fr:)rIr;r)rrÚitemrrrÚ!elementInActiveFormattingElements s  z-TreeBuilder.elementInActiveFormattingElementscCs&|j|ƒ}|jj|ƒ|jj|ƒdS)N)Ú createElementrHr>rNr()rÚtokenr@rrrÚ insertRoots  zTreeBuilder.insertRootcCs6|d}|d}|d}|j|||ƒ}|jj|ƒdS)NrÚpublicIdÚsystemId)Ú doctypeClassrNr()rrirrkrlÚdoctyperrrÚ insertDoctype s zTreeBuilder.insertDoctypecCs*|dkr|jd}|j|j|dƒƒdS)Nr8r)r:)rHr(Ú commentClass)rrirrrrÚ insertComment(s zTreeBuilder.insertCommentcCs0|d}|jd|jƒ}|j||ƒ}|d|_|S)z.Create an element but don't insert it anywhererr]r))ÚgetrEÚ elementClassr)rrirr]r@rrrrh-s   zTreeBuilder.createElementcCs|jS)N)Ú_insertFromTable)rrrrÚ_getInsertFromTable5szTreeBuilder._getInsertFromTablecCs ||_|r|j|_n|j|_dS)zsSwitch the function used to insert an element from the normal one to the misnested table one and back againN)rtÚinsertElementTabler_ÚinsertElementNormal)rrrrrÚ_setInsertFromTable8s zTreeBuilder._setInsertFromTablecCsb|d}t|tƒstd|ƒ‚|jd|jƒ}|j||ƒ}|d|_|jdj|ƒ|jj |ƒ|S)NrzElement %s not unicoder]r)r8r:) rPrrRrrrErsrrHr(r>)rrirr]r@rrrrwCs   zTreeBuilder.insertElementNormalcCs`|j|ƒ}|jdjtkr$|j|ƒS|jƒ\}}|dkrD|j|ƒn |j||ƒ|jj|ƒ|S)z-Create an element and insert it into the treer8Nr:) rhrHrrrwÚgetTableMisnestedNodePositionr(r*r>)rrir@rr*rrrrvMs      zTreeBuilder.insertElementTablecCsX|dkr|jd}|j s0|jr<|jdjtkr<|j|ƒn|jƒ\}}|j||ƒdS)zInsert text data.Nr8r:r:)rHrLrrr+ry)rr)rr*rrrr+]s    zTreeBuilder.insertTextcCsvd}d}d}x(|jddd…D]}|jdkr|}PqW|rd|jrL|j}|}qn|j|jj|ƒd}n |jd}||fS)zsGet the foster parent element, and sibling to insert before (or None) when inserting a misnested table nodeNr8rrr:)rHrrÚindex)rÚ lastTableÚ fosterParentr*Úelmrrrryls  z)TreeBuilder.getTableMisnestedNodePositionc Cs8|jd j}|td ƒkr4||kr4|jjƒ|j|ƒdS) Nr8ÚddÚdtÚlirrÚpÚrpÚrtr:)r~rr€rrr�r‚rƒ)rHrÚ frozensetrdÚgenerateImpliedEndTags)rÚexcluderrrrr…†s    z"TreeBuilder.generateImpliedEndTagscCs|jS)zReturn the final tree)rN)rrrrÚ getDocument�szTreeBuilder.getDocumentcCs|jƒ}|jdj|ƒ|S)zReturn the final fragmentr)Ú fragmentClassrHr0)rÚfragmentrrrÚ getFragment”szTreeBuilder.getFragmentcCst‚dS)z‰Serialize the subtree of node in the format required by unit tests :arg node: the node from which to start serializing N)r&)rr'rrrÚtestSerializer›szTreeBuilder.testSerializer)N)N)N)N)r3r4r5r6rMrsrprmrˆrrFrZrcrergrjrorqrhrurxÚpropertyrLrwrvr+ryr…r‡rŠr‹rrrrrD’s6  .     rD)Ú __future__rrrÚsixrÚ constantsrrr r;r„rSÚobjectrrr7rDrrrrÚs    c