#NEWLINE# def block_code( self , text , lang ) : #NEWLINE# #INDENT# if ( not lang ) : #NEWLINE# #INDENT# return ( '<pre><code>%s</code></pre>' % escape ( text ) ) #NEWLINE# #UNINDENT# inlinestyles = False #NEWLINE# linenos = False #NEWLINE# if hasattr ( self , '_inlinestyles' ) : #NEWLINE# #INDENT# inlinestyles = self . _inlinestyles #NEWLINE# #UNINDENT# if hasattr ( self , '_linenos' ) : #NEWLINE# #INDENT# linenos = self . _linenos #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# lexer = get_lexer_by_name ( lang , stripall = True ) #NEWLINE# formatter = HtmlFormatter ( noclasses = inlinestyles , linenos = linenos ) #NEWLINE# code = highlight ( text , lexer , formatter ) #NEWLINE# if linenos : #NEWLINE# #INDENT# return ( '<div class="highlight-wrapper">%s</div>' % code ) #NEWLINE# #UNINDENT# return code #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# return ( '<pre class="%s"><code>%s</code></pre>' % ( lang , escape ( text ) ) )