<s> from __future__ import unicode_literals <EOL> from webhelpers2 . html import HTML <EOL> class Tag ( list ) : <EOL> """<STR_LIT>""" <EOL> render_if_empty = True <EOL> nl = False <EOL> def __init__ ( self , name , * content , ** attrs ) : <EOL> """<STR_LIT>""" <EOL> super ( Tag , self ) . __init__ ( ) <EOL> self . name = name <EOL> self . attrs = attrs <EOL> self . content = list ( content ) <EOL> def child ( self , child ) : <EOL> """<STR_LIT>""" <EOL> self . content . append ( child ) <EOL> def __html__ ( self ) : <EOL> if not ( self . content or self . render_if_empty ) : <EOL> return HTML . EMPTY <EOL> return HTML . tag ( self . name , _nl = self . nl , * self . content , ** self . attrs ) <EOL> __str__ = __html__ <EOL> class UL ( Tag ) : <EOL> name = "<STR_LIT>" <EOL> nl = True <EOL> render_if_empty = False <EOL> def __init__ ( self , ** attrs ) : <EOL> super ( UL , self ) . __init__ ( self . name , ** attrs ) <EOL> def item ( self , item , ** attrs ) : <EOL> """<STR_LIT>""" <EOL> item = self . __class__ ( "<STR_LIT>" , item , ** attrs ) <EOL> self . content . append ( item ) <EOL> class OL ( UL ) : <EOL> name = "<STR_LIT>" <EOL> class DL ( UL ) : <EOL> name = "<STR_LIT>" <EOL> def item ( self , term , definition ) : <EOL> """<STR_LIT>""" <EOL> dt = self . __class__ ( "<STR_LIT>" , term ) <EOL> dd = self . __class__ ( "<STR_LIT>" , definition ) <EOL> self . content . append ( dt ) <EOL> self . content . append ( dd ) </s>
