Ñò †°Ic @sÈdZddklZddklZyddkiiZWn"e j oddk iZnXdZ ddd„ƒYZ e ƒZ deifd „ƒYZd efd „ƒYZd „Zd gZdS(s Kind of like htmlgen, only much simpler. The only important symbol that is exported is ``html``. This builds ElementTree nodes, but with some extra useful methods. (Open issue: should it use ``ElementTree`` more, and the raw ``Element`` stuff less?) You create tags with attribute access. I.e., the ``A`` anchor tag is ``html.a``. The attributes of the HTML tag are done with keyword arguments. The contents of the tag are the non-keyword arguments (concatenated). You can also use the special ``c`` keyword, passing a list, tuple, or single tag, and it will make up the contents (this is useful because keywords have to come after all non-keyword arguments, which is non-intuitive). Or you can chain them, adding the keywords with one call, then the body with a second call, like:: >>> print html.a(href='http://yahoo.com')('') <Yahoo> Note that strings will be quoted; only tags given explicitly will remain unquoted. If the value of an attribute is None, then no attribute will be inserted. So:: >>> print html.a(href='http://www.yahoo.com', name=None, ... c='Click Here') Click Here If the value is None, then the empty string is used. Otherwise str() is called on the value. ``html`` can also be called, and it will produce a special list from its arguments, which adds a ``__str__`` method that does ``html.str`` (which handles quoting, flattening these lists recursively, and using '' for ``None``). ``html.comment`` will generate an HTML comment, like ``html.comment('comment text')`` -- note that it cannot take keyword arguments (because they wouldn't mean anything). Examples:: >>> print html.html( ... html.head(html.title("Page Title")), ... html.body( ... bgcolor='#000066', ... text='#ffffff', ... c=[html.h1('Page Title'), ... html.p('Hello world!')], ... )) Page Title

Page Title

Hello world!

>>> print html.a(href='#top')('return to top') return to top iÿÿÿÿ(t generators(tescapeNsutf-8t_HTMLcBs/eZd„Zd„Zd„Zdd„ZRS(cCsŸ|idƒo t‚n|iƒ}|idƒo|d }n|idƒdjo|iddƒ}n|djottihƒSt|hƒSdS(Nt_iÿÿÿÿt__t:tcomment( t startswithtAttributeErrortlowertendswithtfindtreplacetElementtETtComment(tselftattr((s6/usr/lib/python2.6/site-packages/formencode/htmlgen.pyt __getattr__Gs   cGs t|ƒS(N(t ElementList(Rtargs((s6/usr/lib/python2.6/site-packages/formencode/htmlgen.pyt__call__TscCs.|djodStt|ƒitƒdƒS(Nti(tNoneRtunicodetencodetdefault_encoding(Rtarg((s6/usr/lib/python2.6/site-packages/formencode/htmlgen.pytquoteWs cCs§t|tƒo|S|djodSt|tƒo|itƒSt|ttfƒodit |i|ƒƒSt|t ƒo t|ƒSt|ƒitƒSdS(NR( t isinstancetstrRRRRtlistttupletjointmapR (RRtencoding((s6/usr/lib/python2.6/site-packages/formencode/htmlgen.pyR\s  N(t__name__t __module__RRRRR(((s6/usr/lib/python2.6/site-packages/formencode/htmlgen.pyREs  R cBs,eZd„Zd„Zd„Zd„ZRS(c OsH|i|i|iƒ}|idƒoO|otdƒ‚n|d}|d=t|ttfƒp |f}qwnx«|iƒD]\}}|djo||=q„nt |ƒ||<|i dƒo|||d <||=n|i dƒdjo'|i ddƒ}|||<||=q„q„W|ii|ƒ|i|_d}x'|iƒD]}|}|i|ƒqTWxÐt|ƒD]Â} | djoq~nti| ƒp…|djo<|idjot | ƒ|_q)|it | ƒ7_q@|idjot | ƒ|_q@|it | ƒ7_q~| }|i|ƒq~W|S(NtcsSYou may either provide positional arguments or a 'c' keyword argument, but not bothRiÿÿÿÿRR(t __class__ttagtattribthas_keyt ValueErrorRRR titemsRRR R R tupdatettextt getchildrentappendtflattenRt iselementttail( RRtkwteltnametvaluetnew_nametlasttitemR((s6/usr/lib/python2.6/site-packages/formencode/htmlgen.pyRnsX           cCsti|tƒS(N(RttostringR(R((s6/usr/lib/python2.6/site-packages/formencode/htmlgen.pyt__str__žscCst|ƒitƒS(N(RtdecodeR(R((s6/usr/lib/python2.6/site-packages/formencode/htmlgen.pyt __unicode__¡scCsKt|ƒ}t|ƒdjot|d ƒd}n t|ƒ}d|S(Nis...s (Rtlentrepr(Rtcontent((s6/usr/lib/python2.6/site-packages/formencode/htmlgen.pyt__repr__¥s   (R$R%RR<R>RB(((s6/usr/lib/python2.6/site-packages/formencode/htmlgen.pyR ls 0  RcBseZd„Zd„ZRS(cCs ti|ƒS(N(thtmlR(R((s6/usr/lib/python2.6/site-packages/formencode/htmlgen.pyR<¯scCsdti|ƒS(NsElementList(%s)(RRB(R((s6/usr/lib/python2.6/site-packages/formencode/htmlgen.pyRB²s(R$R%R<RB(((s6/usr/lib/python2.6/site-packages/formencode/htmlgen.pyR­s ccsPxI|D]A}t|ttfƒo x"t|ƒD] }|Vq0Wq|VqWdS(N(RRR R1(R,R:tsub((s6/usr/lib/python2.6/site-packages/formencode/htmlgen.pyR1µs  RC((t__doc__t __future__RtcgiRtxml.etree.ElementTreetetreet ElementTreeRt ImportErrortelementtree.ElementTreeRRRCt_ElementInterfaceR RRR1t__all__(((s6/usr/lib/python2.6/site-packages/formencode/htmlgen.pyt9s% A