-!Lc@s[dZddklZddklZddklZlZdZdZdZ dS( s@gettext message extraction via Babel: http://babel.edgewall.org/i(tStringIO(textract_python(tlexert parsetreeccsn|id|idd}ti|id|i}x(t|i|||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((s8/usr/lib/python2.6/site-packages/mako/ext/babelplugin.pytextracts  c csg}t}xl|D]d}d }|o+t|tio|ii oqnt|tio|ii}|o |i t |i |qnxA|D]9} |i | o#t }|i t |i |qqWqnt|tio|ii} |i}n[t|tio|ii} |i}n/t|tio|ii} n t|tioZdig} |iiD]\} } | d| | fq~ }d|} |i}nt|tio*|iog}t}qn|i} nbt|tiog}t}|ii} n3t|tio|ii} ng}t}q|o&|dd|i djo g}n&g}|D]}||dq~}t| to| idd} nt| } xIt | |||D]2\}}}}|i |d||||fVqWg}t}|o)x&t!||||D] }|VqdWqqWd 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}iiitasciitbackslashreplaceN("tFalseRt isinstanceRtTexttcontenttstriptCommentttexttextendt_split_commenttlinenot startswithtTruetDefTagt function_decltcodetnodestCallTagtPageTagt body_decltCallNamespaceTagtjoint attributest iteritemst ControlLinetisendtCodet ExpressiontunicodetencodeRRR (R%RRRttranslator_commentstin_translator_commentstnodet child_nodestvaluet comment_tagR$t_[1]tkeytvaltattribst_[2]tcommentRtfuncnametmessagestpython_translator_commentsR((s8/usr/lib/python2.6/site-packages/mako/ext/babelplugin.pyR s      6     % cCs;g}t|iD]\}}||||fq~S(svReturn the multiline comment at lineno split into a list of comment line numbers and the accompanying comment line(t enumeratet splitlines(RR>R9tindextline((s8/usr/lib/python2.6/site-packages/mako/ext/babelplugin.pyRwsN( t__doc__Rtbabel.messages.extractRtmakoRRRR R(((s8/usr/lib/python2.6/site-packages/mako/ext/babelplugin.pyts   [