ó žòœMc@s[dZddlmZddlmZddlmZmZd„Zd„Zd„Z dS( s@gettext message extraction via Babel: http://babel.edgewall.org/iÿÿÿÿ(tStringIO(textract_python(tlexert parsetreeccsn|jd|jddƒƒ}tj|jƒd|ƒjƒ}x(t|jƒ|||ƒD] }|Vq[WdS(sExtract 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`` tinput_encodingtencodingN(tgettNoneRtLexertreadtparset extract_nodest get_children(tfileobjtkeywordst comment_tagstoptionsRt template_nodet extracted((s:/usr/lib/python2.7/vendor-packages/mako/ext/babelplugin.pytextracts ccsNg}t}x;|D]3}d }|rMt|tjƒrM|jjƒ rMqnt|tjƒrÛ|jjƒ}|r“|j t |j |ƒƒqnx?|D]7} |j | ƒršt }|j t |j |ƒƒqšqšWqnt|tjƒr|jj} |j}nDt|tjƒr/|jj} |j}nt|tjƒrP|jj} nùt|tjƒr³djg|jjƒD]\} } d| | f^qxƒ} d| } |j}n–t|tjƒrì|jràg}t}qn|j} n]t|tjƒrg}t}|jj} n0t|tjƒr:|jj} ng}t}q|rs|dd|j dkrsg}ng|D]}|d^qz}t| tƒr´| jddƒ} nt| ƒ} xIt | |||ƒD]2\}}}}|j |d||||fVqÖWg}t}|rx%t!||||ƒD] }|Vq4WqqWd S( s'Extract messages from Mako's lexer node objects :param nodes: an iterable of Mako parsetree.Node objects to extract 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`` s, s%s=%ss{%s}iÿÿÿÿiitasciitbackslashreplaceN("tFalseRt isinstanceRtTexttcontenttstriptCommentttexttextendt_split_commenttlinenot startswithtTruetDefTagt function_decltcodetnodestCallTagtPageTagt body_decltCallNamespaceTagtjoint attributest iteritemst ControlLinetisendtCodet ExpressiontunicodetencodeRRR (R%RRRttranslator_commentstin_translator_commentstnodet child_nodestvaluet comment_tagR$tkeytvaltattribstcommentRtfuncnametmessagestpython_translator_commentsR((s:/usr/lib/python2.7/vendor-packages/mako/ext/babelplugin.pyR "s~        2      % cCs3gt|jƒƒD]\}}|||f^qS(svReturn the multiline comment at lineno split into a list of comment line numbers and the accompanying comment line(t enumeratet splitlines(RR<tindextline((s:/usr/lib/python2.7/vendor-packages/mako/ext/babelplugin.pyR}sN( t__doc__Rtbabel.messages.extractRtmakoRRRR R(((s:/usr/lib/python2.7/vendor-packages/mako/ext/babelplugin.pyts   [