#NEWLINE# def run( self , edit ) : #NEWLINE# #INDENT# settings = sublime . load_settings ( SETTINGS_FILE ) #NEWLINE# site_packages_path = settings . get ( 'site_packages_path' ) #NEWLINE# if ( site_packages_path and ( site_packages_path not in sys . path ) ) : #NEWLINE# #INDENT# sys . path . append ( site_packages_path ) #NEWLINE# #UNINDENT# text = self . view . substr ( Region ( 0 , self . view . size ( ) ) ) #NEWLINE# html = rst_to_html ( text ) #NEWLINE# TEMP_DIR = tempfile . gettempdir ( ) #NEWLINE# if self . view . file_name ( ) : #NEWLINE# #INDENT# preview_filename = ( hashlib . md5 ( self . view . file_name ( ) ) . hexdigest ( ) + '.html' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# preview_filename = 'rst_preview.html' #NEWLINE# #UNINDENT# file_path = os . path . join ( TEMP_DIR , preview_filename ) #NEWLINE# with open ( file_path , 'wb' ) as f : #NEWLINE# #INDENT# f . write ( html ) #NEWLINE# #UNINDENT# webbrowser . open ( ( 'file://%s' % file_path ) )