#NEWLINE# def readme( ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# with open ( os . path . join ( os . path . dirname ( __file__ ) , 'README.rst' ) ) as f : #NEWLINE# #INDENT# readme = f . read ( ) #NEWLINE# #UNINDENT# #UNINDENT# except IOError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# pattern = re . compile ( '\n        (?P<colon> : \\n{2,})?\n        \\s* \\.\\. [ ] code-block:: \\s+ [^\\n]+ \\n\n        [ \\t]* \\n\n        (?P<block>\n            (?: (?: (?: \\t | [ ]{3}) [^\\n]* | [ \\t]* ) \\n)+\n        )\n    ' , re . VERBOSE ) #NEWLINE# return pattern . sub ( ( lambda m : ( ( ( ( ( ':' + m . group ( 'colon' ) ) if m . group ( 'colon' ) else ' ::' ) + '\n\n' ) + '\n' . join ( ( ( ' ' + l ) for l in m . group ( 'block' ) . splitlines ( ) ) ) ) + '\n\n' ) ) , pattern , 0 )