#NEWLINE# def format( self , tokensource , outfile ) : #NEWLINE# #INDENT# enc = self . encoding #NEWLINE# if line . full : #NEWLINE# #INDENT# realoutfile = outfile #NEWLINE# outfile = StringIO . StringIO ( ) #NEWLINE# #UNINDENT# outfile . write ( '\\begin{Verbatim}[commandchars=@\\[\\]' ) #NEWLINE# if self . linenos : #NEWLINE# #INDENT# ( start , step ) = ( self . linenostart , self . linenostep ) #NEWLINE# outfile . write ( ( ( ',numbers=left' + ( ( start and ( ',firstnumber=%d' % start ) ) or '' ) ) + ( ( step and ( ',stepnumber=%d' % step ) ) or '' ) ) ) #NEWLINE# #UNINDENT# if self . verboptions : #NEWLINE# #INDENT# outfile . write ( ( ',' + self . verboptions ) ) #NEWLINE# #UNINDENT# outfile . write ( ']\n' ) #NEWLINE# for ( ttype , value ) in tokensource : #NEWLINE# #INDENT# if enc : #NEWLINE# #INDENT# value = value . encode ( enc ) #NEWLINE# #UNINDENT# value = escape_tex ( value , self . commandprefix ) #NEWLINE# cmd = self . ttype2cmd . get ( ttype ) #NEWLINE# while ( cmd is None ) : #NEWLINE# #INDENT# ttype = ttype . parent #NEWLINE# cmd = self . ttype2cmd . get ( ttype ) #NEWLINE# #UNINDENT# if cmd : #NEWLINE# #INDENT# spl = value . split ( '\n' ) #NEWLINE# for line in spl [ : ( - 1 ) ] : #NEWLINE# #INDENT# if line : #NEWLINE# #INDENT# outfile . write ( ( '@%s[%s]' % ( cmd , line ) ) ) #NEWLINE# #UNINDENT# outfile . write ( '\n' ) #NEWLINE# #UNINDENT# if spl [ ( - 1 ) ] : #NEWLINE# #INDENT# outfile . write ( ( '@%s[%s]' % ( cmd , spl [ ( - 1 ) ] ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# outfile . write ( value ) #NEWLINE# #UNINDENT# #UNINDENT# outfile . write ( '\\end{Verbatim}\n' ) #NEWLINE# if self . full : #NEWLINE# #INDENT# realoutfile . write ( ( DOC_TEMPLATE % dict ( docclass = self . docclass , preamble = self . preamble , title = self . title , encoding = ( self . encoding or 'latin1' ) , styledefs = self . get_style_defs ( ) , code = outfile . getvalue ( ) ) ) )