#NEWLINE# def generate( self , writer , has_links ) : #NEWLINE# #INDENT# writer . write_line ( 'def _tt_execute():' , self . line ) #NEWLINE# with writer . indent ( ) : #NEWLINE# #INDENT# writer . write_line ( '_tt_buffer = []' , self . line ) #NEWLINE# writer . write_line ( '_tt_append = _tt_buffer.append' , self . line ) #NEWLINE# writer . write_line ( 'def _tt_write(t, escape=True):' , self . line ) #NEWLINE# writer . write_line ( '    if escape:' , self . line ) #NEWLINE# writer . write_line ( '        _tt_append(xhtml_escape(_tt_utf8(t)))' , self . line ) #NEWLINE# writer . write_line ( '    else:' , self . line ) #NEWLINE# writer . write_line ( '        _tt_append(_tt_utf8(t))' , self . line ) #NEWLINE# writer . write_line ( '        pass' , self . line ) #NEWLINE# writer . write_line ( '    pass' , self . line ) #NEWLINE# writer . write_line ( 'def out_write(value):' , self . line ) #NEWLINE# writer . write_line ( '    _tt_append(_tt_utf8(value))' , self . line ) #NEWLINE# writer . write_line ( '    pass' , self . line ) #NEWLINE# if has_links : #NEWLINE# #INDENT# writer . write_line ( "_tt_links = {'toplinks': [], 'bottomlinks': [], 'headlinks':[]}" , self . line ) #NEWLINE# writer . write_line ( 'def _tt_use(name, *args, **kwargs):' , self . line ) #NEWLINE# writer . write_line ( '    _tag_use(_tt_links, name, *args, **kwargs)' , has_links . line ) #NEWLINE# writer . write_line ( '    pass' , self . line ) #NEWLINE# writer . write_line ( "def _tt_link(name, to='toplinks', **kwargs):" , self . line ) #NEWLINE# writer . write_line ( '    _tag_link(_tt_links, name, to=to, **kwargs)' , self . line ) #NEWLINE# writer . write_line ( '    pass' , self . line ) #NEWLINE# writer . write_line ( 'def _tt_head(name, **kwargs):' , self . line ) #NEWLINE# writer . write_line ( '    _tag_head(_tt_links, name, **kwargs)' , self . line ) #NEWLINE# writer . write_line ( '    pass' , self . line ) #NEWLINE# writer . write_line ( 'def _tt_head_link(args):' , self . line ) #NEWLINE# writer . write_line ( '    _tag_head_link(_tt_links, args)' , self . line ) #NEWLINE# writer . write_line ( '    pass' , self . line ) #NEWLINE# #UNINDENT# self . body . generate ( writer ) #NEWLINE# if has_links : #NEWLINE# #INDENT# writer . write_line ( "return _tag_htmlmerge(_tt_utf8('').join(_tt_buffer), _tt_links)" , self . line ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# writer . write_line ( "return _tt_utf8('').join(_tt_buffer)" , self . line )