ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ DaYc@sdZddlZddlmZddlmZmZmZmZm Z m Z m Z m Z m Z mZmZmZddlmZddlmZddlmZmZddlmZmZmZdd lmZmZmZd"Z d e!fdYZ"dee"e#fdYZ$edZ%dZ&dZ'de$fdYZ(de$fdYZ)de$fdYZ*de$fdYZ+de$fdYZ,e e-dZ.de#fd YZ/d!Z0e(Z1e)Z2e*Z3e+Z4e,Z5dS(#s  jinja2.ext ~~~~~~~~~~ Jinja extensions allow to add custom tags similar to the way django custom tags work. By default two example extensions exist: an i18n and a cache extension. :copyright: (c) 2017 by the Jinja Team. :license: BSD. iN(tnodes( tBLOCK_START_STRINGtBLOCK_END_STRINGtVARIABLE_START_STRINGtVARIABLE_END_STRINGtCOMMENT_START_STRINGtCOMMENT_END_STRINGtLINE_STATEMENT_PREFIXtLINE_COMMENT_PREFIXt TRIM_BLOCKStNEWLINE_SEQUENCEtKEEP_TRAILING_NEWLINEt LSTRIP_BLOCKS(t Environment(tconcat(tTemplateAssertionErrortTemplateSyntaxError(tcontextfunctiont import_stringtMarkup(twith_metaclasst string_typest iteritemst_tgettexttngettexttExtensionRegistrycBseZdZdZRS(s)Gives the extension an unique identifier.cCs3tj||||}|jd|j|_|S(Nt.(ttypet__new__t __module__t__name__t identifier(tclstnametbasestdtrv((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR%s(RRt__doc__R(((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR"st ExtensioncBsqeZdZeZdZdZdZd dZ dZ dZ d dZ d d d d d dZ RS( sgExtensions can be used to add extra functionality to the Jinja template system at the parser level. Custom extensions are bound to an environment but may not store environment specific data on `self`. The reason for this is that an extension can be bound to another environment (for overlays) by creating a copy and reassigning the `environment` attribute. As extensions are created by the environment they cannot accept any arguments for configuration. One may want to work around that by using a factory function, but that is not possible as extensions are identified by their import name. The correct way to configure the extension is storing the configuration values on the environment. Because this way the environment ends up acting as central configuration storage the attributes may clash which is why extensions have to ensure that the names they choose for configuration are not too generic. ``prefix`` for example is a terrible name, ``fragment_cache_prefix`` on the other hand is a good name as includes the name of the extension (fragment cache). idcCs ||_dS(N(t environment(tselfR(((s./usr/lib/python2.7/site-packages/jinja2/ext.pyt__init__HscCs2tj|j}|jj|j||_|S(s=Create a copy of this extension bound to another environment.(tobjectRt __class__t__dict__tupdateR((R)R(R%((s./usr/lib/python2.7/site-packages/jinja2/ext.pytbindKs cCs|S(sThis method is called before the actual lexing and can be used to preprocess the source. The `filename` is optional. The return value must be the preprocessed source. ((R)tsourceR"tfilename((s./usr/lib/python2.7/site-packages/jinja2/ext.pyt preprocessRscCs|S(sIt's passed a :class:`~jinja2.lexer.TokenStream` that can be used to filter tokens returned. This method has to return an iterable of :class:`~jinja2.lexer.Token`\s, but it doesn't have to return a :class:`~jinja2.lexer.TokenStream`. In the `ext` folder of the Jinja2 source distribution there is a file called `inlinegettext.py` which implements a filter that utilizes this method. ((R)tstream((s./usr/lib/python2.7/site-packages/jinja2/ext.pyt filter_streamYs cCs tdS(sIf any of the :attr:`tags` matched this method is called with the parser as first argument. The token the parser stream is pointing at is the name token that matched. This method has to return one or a list of multiple nodes. N(tNotImplementedError(R)tparser((s./usr/lib/python2.7/site-packages/jinja2/ext.pytparseescCstj|j|d|S(sReturn an attribute node for the current extension. This is useful to pass constants on extensions to generated template code. :: self.attr('_my_attribute', lineno=lineno) tlineno(RtExtensionAttributeR (R)R"R8((s./usr/lib/python2.7/site-packages/jinja2/ext.pytattrmscCsX|dkrg}n|dkr*g}ntj|j|d|||||d|S(ssCall a method of the extension. This is a shortcut for :meth:`attr` + :class:`jinja2.nodes.Call`. R8N(tNoneRtCallR:(R)R"targstkwargstdyn_argst dyn_kwargsR8((s./usr/lib/python2.7/site-packages/jinja2/ext.pyt call_methodws     N(RRR&tsetttagstpriorityR*R/R;R2R4R7R:RA(((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR'+s      cOs|j|jd||S(NR(tcalltresolve(t __contextR=R>((s./usr/lib/python2.7/site-packages/jinja2/ext.pyt_gettext_aliasscstfd}|S(Ncs5|j|}|jjr-t|}n||S(N(REteval_ctxt autoescapeR(RGt__stringt variablesR%(tfunc(s./usr/lib/python2.7/site-packages/jinja2/ext.pyRs (R(RMR((RMs./usr/lib/python2.7/site-packages/jinja2/ext.pyt_make_new_gettextscstfd}|S(NcsK|jd||j|||}|jjrCt|}n||S(Ntnum(t setdefaultRERIRJR(RGt __singulart__pluralt__numRLR%(RM(s./usr/lib/python2.7/site-packages/jinja2/ext.pyRs  (R(RMR((RMs./usr/lib/python2.7/site-packages/jinja2/ext.pyt_make_new_ngettextstInternationalizationExtensioncBseZdZedgZdZd dZd dZd dZ dZ e dZ dZ ejd d Zd Zd ZRS(s.This extension adds gettext support to Jinja2.ttransc Cs^tj||t|jd<|jd|jd|jd|jd|jd|j dt dS(NRtinstall_gettext_translationstinstall_null_translationstinstall_gettext_callablestuninstall_gettext_translationstextract_translationstnewstyle_gettext( R'R*RHtglobalstextendt_installt _install_nullt_install_callablest _uninstallt_extracttFalse(R)R(((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR*s       cCskt|dd}|dkr*|j}nt|dd}|dkrT|j}n|j|||dS(Ntugettextt ungettext(tgetattrR;RRRa(R)t translationstnewstyleRR((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR_s    cCs|jdd|dS(NcSs|S(N((tx((s./usr/lib/python2.7/site-packages/jinja2/ext.pyttcSs |dkr|fp|fdS(Nii((tstptn((s./usr/lib/python2.7/site-packages/jinja2/ext.pyRkRl(Ra(R)Ri((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR`scCsb|dk r||j_n|jjrBt|}t|}n|jjjd|d|dS(NRR(R;R(R\RNRTR]R.(R)RRRi((s./usr/lib/python2.7/site-packages/jinja2/ext.pyRas   cCs+x$dD]}|jjj|dqWdS(NRR(RR(R(R]tpopR;(R)Rhtkey((s./usr/lib/python2.7/site-packages/jinja2/ext.pyRbs cCs1t|tr$|jj|}nt||S(N(t isinstanceRR(R7textract_from_ast(R)R0tgettext_functions((s./usr/lib/python2.7/site-packages/jinja2/ext.pyRcscCsCt|jj}t}d}d}i}d}x|jjjdkr|ra|jjdn|jjdrwPn|jjd}|j |kr|j d|j |jdt n|jjjdkrt|j|j ||j <} nP|dkr'|j dkr'|j dk}q3n t j|j d ||j <} |dkr3t| t jrt jd d }|||j RtKeywordtMarkSafeIfAutoescapetModtDicttitemstPairtOutput( R)RRRLRtvars_referencedRRRRRqR((s./usr/lib/python2.7/site-packages/jinja2/ext.pyRes2     #@N(RRR&RBRCR*R;R_R`RaRbtGETTEXT_FUNCTIONSRcR7tretcompileRRR(((s./usr/lib/python2.7/site-packages/jinja2/ext.pyRUs    i tExprStmtExtensioncBs&eZdZedgZdZRS(ssAdds a `do` tag to Jinja2 that works like the print statement just that it doesn't print the return value. tdocCs1tjdt|jj}|j|_|S(NR8(RtExprStmtRR3R8t parse_tupleR(R)R6R((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR7s(RRR&RBRCR7(((s./usr/lib/python2.7/site-packages/jinja2/ext.pyRstLoopControlExtensioncBs)eZdZeddgZdZRS(s/Adds break and continue to the template engine.tbreaktcontinuecCsDt|j}|jdkr1tjd|jStjd|jS(NRR8(RR3RRtBreakR8tContinue(R)R6ttoken((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR7s(RRR&RBRCR7(((s./usr/lib/python2.7/site-packages/jinja2/ext.pyRst WithExtensioncBseZRS((RR(((s./usr/lib/python2.7/site-packages/jinja2/ext.pyRstAutoEscapeExtensioncBseZRS((RR(((s./usr/lib/python2.7/site-packages/jinja2/ext.pyRsccsyxr|jtjD]^}t|jtj s|jj|krGqng}xU|jD]J}t|tjrt|j t r|j |j qW|j dqWWx|j D]}|j dqW|jdk r|j dn|jdk r|j dn|s/td|D}|sZqqZn+t|dkrN|d}n t|}|j|jj|fVqWdS(sExtract localizable strings from the given template node. Per default this function returns matches in babel style that means non string parameters as well as keyword arguments are returned as `None`. This allows Babel to figure out what you really meant if you are using gettext functions that allow keyword arguments for placeholder expansion. If you don't want that behavior set the `babel_style` parameter to `False` which causes only strings to be returned and parameters are always stored in tuples. As a consequence invalid gettext calls (calls without a single string parameter or string parameters after non-string parameters) are skipped. This example explains the behavior: >>> from jinja2 import Environment >>> env = Environment() >>> node = env.parse('{{ (_("foo"), _(), ngettext("foo", "bar", 42)) }}') >>> list(extract_from_ast(node)) [(1, '_', 'foo'), (1, '_', ()), (1, 'ngettext', ('foo', 'bar', None))] >>> list(extract_from_ast(node, babel_style=False)) [(1, '_', ('foo',)), (1, 'ngettext', ('foo', 'bar'))] For every string found this function yields a ``(lineno, function, message)`` tuple, where: * ``lineno`` is the number of the line on which the string was found, * ``function`` is the name of the ``gettext`` function used (if the string was extracted from embedded Python code), and * ``message`` is the string itself (a ``unicode`` object, or a tuple of ``unicode`` objects for functions with multiple string arguments). This extraction function operates on the AST and is because of that unable to extract any comments. For comment support you have to use the babel extraction interface or extract comments yourself. css!|]}|dk r|VqdS(N(R;(t.0Rj((s./usr/lib/python2.7/site-packages/jinja2/ext.pys siiN(tfind_allRR<RrRRR"R=RRRRR;R>R?R@ttupletlenR8(RRtt babel_styletstringstarg((s./usr/lib/python2.7/site-packages/jinja2/ext.pyRss0$   t_CommentFindercBs)eZdZdZdZdZRS(sHelper class to find comments in a token stream. Can only find comments for gettext calls forwards. Once the comment from line 4 is found, a comment for line 1 will not return a usable value. cCs(||_||_d|_d|_dS(Ni(ttokenst comment_tagstoffsett last_lineno(R)RR((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR*s   cCszxt|j|j|!D]m\}}}|dkry|jdd\}}Wntk rjqnX||jkr|jgSqqWgSWd||_XdS(Ntcommentt linecommenti(RR(treversedRRtsplitR;t ValueErrorRtrstrip(R)RRt token_typet token_valuetprefixR((s./usr/lib/python2.7/site-packages/jinja2/ext.pytfind_backwardss&  cCs|j s|j|krgSxMt|j|jD]5\}\}}}||kr4|j|j|Sq4W|jt|jS(N(RRt enumerateRRRR(R)R8tidxt token_linenoR((s./usr/lib/python2.7/site-packages/jinja2/ext.pyt find_commentss , (RRR&R*RR(((s./usr/lib/python2.7/site-packages/jinja2/ext.pyRs  ccs_t}xN|jddjdD]1}|j}|sCq%n|jt|q%Wt|krv|jtntd}||dt}t |jdt |jdt |jdt |jd t |jd t|jd t|jd pt|jd pt||dt||dtt||dtt|dddt }||drt|jd s8 R Y    C% Q