ó
­V]c           @   s  d  d l  m Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ e d e j ƒ e j d	 <e d e j d
 d ƒ e j d <e d e j ƒ e j d <e d d ƒ e j d <e d e j ƒ e j d	 <e d e j ƒ e j d <e e e j	 d d ƒƒ e j d <d S(   iÿÿÿÿ(   t   EntitySubstitutiont	   Formatterc           B   sz   e  Z d  Z i  Z i  Z d Z d Z e d e d d g ƒ ƒ Z	 d „  Z
 d d d d d „ Z d	 „  Z d
 „  Z d „  Z RS(   sÍ   Describes a strategy to use when outputting a parse tree to a string.

    Some parts of this strategy come from the distinction between
    HTML4, HTML5, and XML. Others are configurable by the user.
    t   htmlt   xmlt   cdata_containing_tagst   scriptt   stylec         C   s1   | d  k	 r | S| |  j k r& t ƒ  S|  j | S(   N(   t   Nonet   XMLt   sett   HTML_DEFAULTS(   t   selft   languaget   valuet   kwarg(    (    s,   lib/python2.7/site-packages/bs4/formatter.pyt   _default   s
    t   /c         C   s7   | |  _  | |  _ | |  _ |  j | | d ƒ |  _ d S(   s|   

        :param void_element_close_prefix: By default, represent void
        elements as <tag/> rather than <tag>
        R   N(   R   t   entity_substitutiont   void_element_close_prefixR   R   (   R   R   R   R   R   (    (    s,   lib/python2.7/site-packages/bs4/formatter.pyt   __init__   s
    				c         C   sa   |  j  s | Sd d l m } t | | ƒ rT | j d k	 rT | j j |  j k rT | S|  j  | ƒ S(   s;   Process a string that needs to undergo entity substitution.iÿÿÿÿ(   t   NavigableStringN(   R   t   elementR   t
   isinstancet   parentR   t   nameR   (   R   t   nsR   (    (    s,   lib/python2.7/site-packages/bs4/formatter.pyt
   substitute+   s    	c         C   s   |  j  | ƒ S(   s"   Process the value of an attribute.(   R   (   R   R   (    (    s,   lib/python2.7/site-packages/bs4/formatter.pyt   attribute_value8   s    c         C   s   t  | j j ƒ  ƒ S(   s,   Reorder a tag's attributes however you want.(   t   sortedt   attrst   items(   R   t   tag(    (    s,   lib/python2.7/site-packages/bs4/formatter.pyt
   attributes<   s    N(   t   __name__t
   __module__t   __doc__t   XML_FORMATTERSt   HTML_FORMATTERSt   HTMLR   t   dictR	   R
   R   R   R   R   R   R    (    (    (    s,   lib/python2.7/site-packages/bs4/formatter.pyR      s   			t   HTMLFormatterc           B   s   e  Z i  Z d  „  Z RS(   c         O   s   t  t |  ƒ j |  j | | Ž S(   N(   t   superR(   R   R&   (   R   t   argst   kwargs(    (    s,   lib/python2.7/site-packages/bs4/formatter.pyR   C   s    (   R!   R"   t   REGISTRYR   (    (    (    s,   lib/python2.7/site-packages/bs4/formatter.pyR(   A   s   t   XMLFormatterc           B   s   e  Z i  Z d  „  Z RS(   c         O   s   t  t |  ƒ j |  j | | Ž S(   N(   R)   R-   R   R   (   R   R*   R+   (    (    s,   lib/python2.7/site-packages/bs4/formatter.pyR   I   s    (   R!   R"   R,   R   (    (    (    s,   lib/python2.7/site-packages/bs4/formatter.pyR-   G   s   R   R   R   t   html5t   minimalN(
   t
   bs4.dammitR    R   R(   R-   t   substitute_htmlR,   R   t   substitute_xmlR   (    (    (    s,   lib/python2.7/site-packages/bs4/formatter.pyt   <module>   s$   >	