#NEWLINE# def rst_to_html( source ) : #NEWLINE# #INDENT# html = publish_string ( source , writer = html_fragment_writer ) #NEWLINE# html = html . split ( b'<div class="document">\n\n\n' ) [ 1 ] [ : ( - 8 ) ] #NEWLINE# if html . startswith ( b'<p>' ) : #NEWLINE# #INDENT# html = html [ 3 : ] #NEWLINE# #UNINDENT# if html . endswith ( b'</p>' ) : #NEWLINE# #INDENT# html = html [ : ( - 4 ) ] #NEWLINE# #UNINDENT# return html . decode ( )