-!Lc @ s[ d Z d d k l Z d d k l Z d d k l Z l 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 parsetreec c sn | i d | i d d } t i | i d | i } x( t | i | | | 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( ( s8 /usr/lib/python2.6/site-packages/mako/ext/babelplugin.pyt extract s c c s g } t } xl| D]d} d } | o+ t | t i o | i i o q n t | t i o | i i } | o | i t | i | q n xA | D]9 } | i | o# t } | i t | i | q q Wq n t | t i o | i i } | i } n[t | t i o | i i } | i } n/t | t i o | i i } nt | t i oZ d i g } | i i D] \ } } | d | | f q~ } d | } | i } n t | t i o* | i o g } t } q n | i } nb t | t i o g } t } | i i } n3 t | t i o | i i } n g } t } q | o&