ÿØÿà JFIF      ÿÛ „ 	 ( %!1!%)+//.383,7(-.+



-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ  ¥2" ÿÄ               ÿÄ J  	     ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ              ÿÄ *        !1AQa‘"2q3±ð#b¡ÿÚ   ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁT­ÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßw­pŽF|È¥ù®häðÍÑ¶¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
..............................................................................................................................................................................
.............................................................................                                                  
                                                                                                                                                                                     ÿØÿà JFIF      ÿÛ „ 	 ( %!1!%)+//.383,7(-.+



-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ  ¥2" ÿÄ               ÿÄ J  	     ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ              ÿÄ *        !1AQa‘"2q3±ð#b¡ÿÚ   ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁT­ÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßw­pŽF|È¥ù®häðÍÑ¶¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
..............................................................................................................................................................................
.............................................................................                                                  
                                                                                                                                                                                     3
v:U](                 @   s   d dl Zd dlmZ dd ejj D Zdd Zdd Zd	d
 Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zd#ddZdd Zd$d!d"ZdS )%    N)configc             C   s&   i | ]\}}|d kr|t jj| qS )Znbsp)htmlZentitiesZname2codepoint).0kv r   /usr/lib/python3.6/utils.py
<dictcomp>   s   r	   c             C   sD   | d dkr@t | dkr@| d }d|  k o2dkn  r@t|S dS )Nr   h      09)lenint)tagnr   r   r   hn   s
    r   c             C   s   dd dd | j dD D S )z,
    :returns: A hash of css attributes
    c             S   s&   i | ]\}}|j  j |j  j qS r   )striplower)r   xyr   r   r   r	      s   z&dumb_property_dict.<locals>.<dictcomp>c             S   s    g | ]}d |kr|j d dqS ):r   )split)r   zr   r   r   
<listcomp>   s    z&dumb_property_dict.<locals>.<listcomp>;)r   )styler   r   r   dumb_property_dict   s    r   c             C   s   | d7 } | j d}x:|dkrL| d| | | j d|d d  } | j d}qW dd | jdD }yd	d
 |D }W n tk
r   i }Y nX |S )z
    :type data: str

    :returns: A hash of css selectors, each of which contains a hash of
    css attributes.
    :rtype: dict
    r   z@importr   r   Nc             S   s"   g | ]}d |j  kr|jd qS ){)r   r   )r   r   r   r   r   r   /   s    z#dumb_css_parser.<locals>.<listcomp>}c             S   s   i | ]\}}t ||j qS r   )r   r   )r   abr   r   r   r	   1   s    z#dumb_css_parser.<locals>.<dictcomp>)findr   
ValueError)dataZimportIndexelementsr   r   r   dumb_css_parser   s    	

$
r(   c             C   sb   |j  }d| kr@x.| d j D ]}|jd| i }|j| qW d| kr^t| d }|j| |S )z
    :type attrs: dict
    :type style_def: dict
    :type style_def: dict

    :returns: A hash of the 'final' style attributes of the element
    :rtype: dict
    class.r   )copyr   getupdater   )attrsZ	style_defZparent_styler   Z	css_classZ	css_styleZimmediate_styler   r   r   element_style8   s    	
r/   c             C   s    d| kr| d }|dkrdS dS )	zh
    Finds out whether this is an ordered or unordered list

    :type style: dict

    :rtype: str
    zlist-style-typedisccirclesquarenoneZulZol)r0   r1   r2   r3   r   )r   Z
list_styler   r   r   google_list_styleM   s
    r4   c             C   s   d| kS )z
    Check if the style of the element has the 'height' attribute
    explicitly defined

    :type style: dict

    :rtype: bool
    Zheightr   )r   r   r   r   google_has_height]   s    	r5   c             C   sJ   g }d| kr|j | d  d| kr0|j | d  d| krF|j | d  |S )zk
    :type style: dict

    :returns: A list of all emphasis modifiers of the element
    :rtype: list
    ztext-decorationz
font-stylezfont-weight)append)r   Zemphasisr   r   r   google_text_emphasisi   s    r7   c             C   s$   d}d| kr| d }d|kp"d|kS )zu
    Check if the css of the current element defines a fixed width font

    :type style: dict

    :rtype: bool
     zfont-familyzcourier newZconsolasr   )r   Zfont_familyr   r   r   google_fixed_width_font{   s    r9   c             C   s2   d| kr.yt | d d S  tk
r,   Y nX dS )zh
    Extract numbering from list element attributes

    :type attrs: dict

    :rtype: int or None
    startr   r   )r   r%   )r.   r   r   r   list_numbering_start   s    r;   c             C   s   t tjj| dkr| rdS | dd dks:| d dkr>dS | j }|dd dkrrt |dkrr|d dkrrd	S |dd
 dkr|dd dk r| S ttjj|ptjj|S )Nr   T   z    	r   z---Fr   *z**)r>   r?   )	r   r   ZRE_LINKfindalllstripboolZRE_ORDERED_LIST_MATCHERmatchZRE_UNORDERED_LIST_MATCHER)ZparaZ
wrap_linksZwrap_list_itemsstrippedr   r   r   skipwrap   s    ("rE   c             C   s   t jjd| S )zU
    Escapes markdown-sensitive characters within other markdown
    constructs.
    z\\\1)r   ZRE_MD_CHARS_MATCHERsub)textr   r   r   	escape_md   s    rH   Fc             C   sN   t jjd| } |r t jjd| } t jjd| } t jjd| } t jjd| } | S )zO
    Escapes markdown-sensitive characters across whole document sections.
    z\\\1z\1\\\2)r   ZRE_MD_BACKSLASH_MATCHERrF   ZRE_MD_CHARS_MATCHER_ALLZRE_MD_DOT_MATCHERZRE_MD_PLUS_MATCHERZRE_MD_DASH_MATCHER)rG   Zsnobr   r   r   escape_md_section   s    rI   c       	         s<  fdd| d j dD }t|}x| D ]}dd |j dD }t|}||k rf|dg||  7 }n0||k r|fdd|||  d D 7 }|}fd	dt||D }q*W g }x| D ]x}d
d |j dD }t|j tdkrd  fddt||D }nd  fddt||D }|jdj| qW |S )zR
    Given the lines of a table
    padds the cells and returns the new lines
    c                s   g | ]}t |j   qS r   )r   rstrip)r   r   )right_marginr   r   r      s    z"reformat_table.<locals>.<listcomp>r   |c             S   s   g | ]}|j  qS r   )rJ   )r   r   r   r   r   r      s    r8   c                s   g | ]}t |  qS r   )r   )r   r   )rK   r   r   r      s    Nc                s"   g | ]\}}t t|  |qS r   )maxr   )r   r   Zold_len)rK   r   r   r      s    c             S   s   g | ]}|j  qS r   )rJ   )r   r   r   r   r   r      s    z-|r>   c                s,   g | ]$\}}|j   |t|j     qS r   )rJ   r   )r   r   M)fillerr   r   r      s    c                s,   g | ]$\}}|j   |t|j     qS r   )rJ   r   )r   r   rN   )rO   r   r   r      s   )r   r   zipsetr   r6   join)	linesrK   Z	max_widthZmax_colslineZcolsZnum_cols	new_linesZnew_colsr   )rO   rK   r   reformat_table   s.    
$


rW   r   c             C   s   | j d}g d }}g }x^|D ]V}tj|krZ| }|st||}|j| g }|jd q|rj|j| q|j| qW dj|S )z0
    Provide padding for tables in the text
    
Fr8   )r   r   ZTABLE_MARKER_FOR_PADrW   extendr6   rS   )rG   rK   rT   Ztable_bufferZtable_startedrV   rU   tabler   r   r   pad_tables_in_text   s     






r[   )F)r   )Zhtml.entitiesr   Z	html2textr   Z	UNIFIABLEitemsZunifiable_nr   r   r(   r/   r4   r5   r7   r9   r;   rE   rH   rI   rW   r[   r   r   r   r   <module>   s"   

+