#NEWLINE# def _handle_sourcecode( self , match ) : #NEWLINE# #INDENT# from pygments.lexers import get_lexer_by_name #NEWLINE# from pygments.util import ClassNotFound #NEWLINE# ( yield ( match . start ( 1 ) , Punctuation , match . group ( 1 ) ) ) #NEWLINE# ( yield ( match . start ( 2 ) , Text , match . group ( 2 ) ) ) #NEWLINE# ( yield ( match . start ( 3 ) , Operator . Word , match . group ( 3 ) ) ) #NEWLINE# ( yield ( match . start ( 4 ) , Punctuation , match . group ( 4 ) ) ) #NEWLINE# ( yield ( match . start ( 5 ) , Text , match . group ( 5 ) ) ) #NEWLINE# ( yield ( match . start ( 6 ) , Keyword , match . group ( 6 ) ) ) #NEWLINE# ( yield ( match . start ( 7 ) , Text , match . group ( 7 ) ) ) #NEWLINE# lexer = None #NEWLINE# if self . handlecodeblocks : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# lexer = get_lexer_by_name ( match . group ( 6 ) . strip ( ) ) #NEWLINE# #UNINDENT# except ClassNotFound : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# indention = match . group ( 8 ) #NEWLINE# indention_size = len ( indention ) #NEWLINE# code = ( ( ( indention + match . group ( 9 ) ) + match . group ( 10 ) ) + match . group ( 11 ) ) #NEWLINE# if ( lexer is None ) : #NEWLINE# #INDENT# ( yield ( match . start ( 8 ) , String , code ) ) #NEWLINE# return #NEWLINE# #UNINDENT# ins = [ ] #NEWLINE# codelines = code . splitlines ( True ) #NEWLINE# code = '' #NEWLINE# for line in codelines : #NEWLINE# #INDENT# if ( len ( line ) > indention_size ) : #NEWLINE# #INDENT# ins . append ( ( len ( code ) , [ ( 0 , Text , line [ : indention_size ] ) ] ) ) #NEWLINE# code += line [ indention_size : ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# code += line #NEWLINE# #UNINDENT# #UNINDENT# for item in do_insertions ( ins , lexer . get_tokens_unprocessed ( code ) ) : #NEWLINE# #INDENT# ( yield item )