Ñò ûãtHc @sdZddklZddklZlZlZlZlZddkl Z l Z l Z l Z l Z lZlZddklZddklZlZlZlZlZlZlZddklZddklZdd kTdd kl Z d gZ!d Z"d efd „ƒYZ#dS(sMarkup templating engine.iÿÿÿÿ(tchain(tAttrstMarkupt NamespacetStreamtStreamEventKind(tSTARTtENDtSTART_NStEND_NStTEXTtPItCOMMENT(t XMLParser(tBadDirectiveErrortTemplatetTemplateSyntaxErrort_apply_directivestEXECtINCLUDEtSUB(tSuite(t interpolate(t*(tNewTextTemplatetMarkupTemplatesrestructuredtext enc BsÅeZdZedƒZedƒZdefdefdefde fde fde fd e fd e fd efd efd efdefg ZdZeZd„Zd„Zddd„ZRS(s@Implementation of the template language for XML-based templates. >>> tmpl = MarkupTemplate('''''') >>> print tmpl.generate(items=[1, 2, 3]) shttp://genshi.edgewall.org/shttp://www.w3.org/2001/XIncludetdeftmatchtwhent otherwisetfortiftchoosetwithtreplacetcontenttattrststriptxmlcCshti|ƒ|io|ii|iƒn|i|ig7_|io|ii|iƒndS(N(Rt _init_filterstloadertfilterstremovet_includet_matchtappend(tself((s</usr/lib64/python2.6/site-packages/genshi/template/markup.pyR'?s    c! s½gg}h}h}d}g}g}t|tƒpt|d|id|ƒ}nx\|D]T\} } } |d} | tjoM| \} }||| <||i|ifjo| i| | | fƒq±q]| tjoP|i | dƒ}|o3||i|ifjo| i| | | fƒq±q]| t jo:| \}}g}t }||ijo¯|i i|iƒ}|djo t|i|i| dƒ‚ntg}|D]*\}}|ip||i|fq²q²~ƒ}|i|||iƒ| fƒt}ng}x"|D]\}}||ijoe|i i|iƒ}|djo t|i|i| dƒ‚n|i|||iƒ| fƒq|omtt||i| d| dd|iƒƒ}t|ƒdjo'|ddtjo|dd}q%ntd| fg}|i||fƒqWt|ƒ}|oE|ii‰|i‡fd †ƒ|t| ƒ|f|||f‹stincludethrefs(Include misses required attribute "href"tparsetfallbackR&ttexts.Invalid value for "parse" attribute of includetpythonsPython code blocks not allowedt!(0t isinstanceRR R/RtDIRECTIVE_NAMESPACEtXINCLUDE_NAMESPACER-R tpoptNoneRtFalset _dir_by_nametgett localnameRtfilepathtdictt namespacetcopytTruetlistRR1tlenR Rt _dir_orderR5tsortRRRRtKeyErrorRRR t allow_execRt SyntaxErrortlinenotoffsetRR tlstript startswith(!R.tsourceR0tstreamstdirmapt ns_prefixtdeptht fallbackstincludestkindtdatatpoststreamtprefixturittagR$t directivesR%tclst_[1]tnametvaluetargst new_attrst include_hrefR:R8R9t start_offsett substreamtsuiteterr((R5s</usr/lib64/python2.6/site-packages/genshi/template/markup.pyt_parseHsò            :    #(  #     #       ic+s ˆi}g‰‡fd†}xä|D]Ü}| p"|dtj o|dtj o |Vq%nxt|ƒD]Š\} \} } } } ‰}| |jp|d j o| |joqnn| |ˆˆƒtjo%d| jo|| =| d8} nxKg}|| dD]}||dq ~D]} | |ˆˆdtƒq#W| d}d| jod| jo|d8}n||ƒ}|djo|i|ˆd|ƒ}n|it|g|ˆƒˆƒ‰d| jot ˆƒ‰nt g‰‡‡‡‡fd †}t d |ƒ}t | |ˆ|} xY|i|i |i|i| ˆ|ˆ|ˆ|ˆd | d|D] }|VqzWˆdpxˆD]}q›WnxGg}|D]}||dq·~D] } | ˆdˆˆdtƒqÏWPqnqnW|Vq%Wd S( s_Internal stream filter that applies any defined match templates to the stream. c3s{d}xn|iƒ}|dtjo|d7}n |dtjo|d8}n|djo |Vq |gˆ(Pq dS(Nii(tnextRR(RaR[tevent(ttail(s</usr/lib64/python2.6/site-packages/genshi/template/markup.pyt_stripçs    it match_onceit updateonlyt not_recursivetendt not_bufferedcs#tˆds(44