File: //opt/alt/python27/lib/python2.7/site-packages/mako/ext/babelplugin.pyo
�
�ǚPc           @   sa   d  Z  d d l m Z d d l m Z d d l m Z m Z m Z d �  Z d �  Z	 d �  Z
 d S(	   s@   gettext message extraction via Babel: http://babel.edgewall.org/i����(   t   StringIO(   t   extract_python(   t   lexert	   parsetreet   utilc         c   sn   | j  d | j  d d � � } t j |  j �  d | �j �  } x( t | j �  | | | � D] } | Vq[ Wd S(   s  Extract messages from Mako templates.
    :param fileobj: the file-like object the messages should be extracted from
    :param keywords: a list of keywords (i.e. function names) that should be
                     recognized as translation functions
    :param comment_tags: a list of translator tags to search for and include
                         in the results
    :param options: a dictionary of additional options (optional)
    :return: an iterator over ``(lineno, funcname, message, comments)`` tuples
    :rtype: ``iterator``
    t   input_encodingt   encodingN(   t   gett   NoneR   t   Lexert   readt   parset
   extract_nodest   get_children(   t   fileobjt   keywordst   comment_tagst   optionsR   t
   template_nodet	   extracted(    (    sE   /opt/alt/python27/lib/python2.7/site-packages/mako/ext/babelplugin.pyt   extract   s    c         c   s�  g  } t  } xo|  D]g} d	 } | rM t | t j � rM | j j �  rM q n  t | t j � r� | j j �  } | r� | j	 t
 | j | � � q n  x? | D]7 }	 | j |	 � r� t
 } | j	 t
 | j | � � q� q� Wq n  t | t j � r| j j }
 | j } nnt | t j � r/| j j }
 | j } nDt | t j � rY| j j }
 | j } nt | t j � rz| j j }
 n� t | t j � r�d j g  | j j �  D] \ } } d | | f ^ q�� }
 d |
 }
 | j } n� t | t j � r| j r
g  } t  } q n  | j }
 n] t | t j � rCg  } t  } | j j }
 n0 t | t j � rd| j j }
 n g  } t  } q | r�| d d | j d k  r�g  } n g  | D] } | d ^ q�} t j r�t |
 t  � r�|
 j! d d � }
 n  t"