Ńň ŞJc @ s& d Z d d k Z d d k l Z l Z d d k l Z d d k l Z l Z d d k l Z y e Z Wn e j o e e f Z n Xd e f d YZ d e f d YZ d Z e d d Z e e d d Z e e d d Z e d d Z e d d Z e Z e Z d S( s An interface to html5lib. i˙˙˙˙N( t HTMLParsert XHTMLParser( t etree( t _contains_block_level_tagt XHTML_NAMESPACE( t TreeBuilderR c B s e Z d Z e d Z RS( s* An html5lib HTML parser with lxml as tree.c C s t i | d | d t d S( Nt strictt tree( t _HTMLParsert __init__R ( t selfR ( ( s; /usr/lib64/python2.6/site-packages/lxml/html/html5parser.pyR s ( t __name__t __module__t __doc__t FalseR ( ( ( s; /usr/lib64/python2.6/site-packages/lxml/html/html5parser.pyR s R c B s e Z d Z e d Z RS( s+ An html5lib XHTML Parser with lxml as tree.c C s t i | d | d t d S( NR R ( t _XHTMLParserR R ( R R ( ( s; /usr/lib64/python2.6/site-packages/lxml/html/html5parser.pyR s ( R R R R R ( ( ( s; /usr/lib64/python2.6/site-packages/lxml/html/html5parser.pyR s c C s8 | i | } | d j o | S| i d t | f S( Ns {%s}%s( t findt NoneR ( R t tagt elem( ( s; /usr/lib64/python2.6/site-packages/lxml/html/html5parser.pyt _find_tag s c C sP t | t p t d n | d j o t } n | i | d | i S( s% Parse a whole document into a string.s string requiredt useChardetN( t isinstancet _stringst TypeErrorR t html_parsert parset getroot( t htmlt guess_charsett parser( ( s; /usr/lib64/python2.6/site-packages/lxml/html/html5parser.pyt document_fromstring' s c C s° t | t p t d n | d j o t } n | i | d d | } | oV t | d t oB | o7 | d i o t i d | d n | d =qŹ n | S( s Parses several HTML elements, returning a list of elements. The first item in the list may be a string. If no_leading_text is true, then it will be an error if there is leading text, and it will always be a list of only elements. If `guess_charset` is `True` and the text was not unicode but a bytestring, the `chardet` library will perform charset guessing on the string. s string requiredt divR i s There is leading text: %rN( R R R R R t parseFragmentt stripR t ParserError( R t no_leading_textR R t children( ( s; /usr/lib64/python2.6/site-packages/lxml/html/html5parser.pyt fragments_fromstring2 s c C së t | t p t d n | o$ | p d } d | | | f } n t | t | | } | p t i d n t | d j o t i d n | d } | i o* | i i o t i d | i n d | _ | S( s Parses a single HTML element; it is an error if there is more than one element, or if anything but whitespace precedes or follows the element. If create_parent is true (or is a tag name) then a parent node will be created to encapsulate the HTML in a single element. s string requiredR s <%s>%s%s>s No elements foundi s Multiple elements foundi s Element followed by text: %rN( R R R R&