#NEWLINE# def stylesheet_call( self , path ) : #NEWLINE# #INDENT# 'Return code to reference or embed stylesheet file `path`' #NEWLINE# if self . settings . embed_stylesheet : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# content = io . FileInput ( source_path = path , encoding = 'utf-8' ) . read ( ) #NEWLINE# self . settings . record_dependencies . add ( path ) #NEWLINE# #UNINDENT# except IOError as err : #NEWLINE# #INDENT# msg = ( "Cannot embed stylesheet '%s': %s." % ( path , SafeString ( err . strerror ) ) ) #NEWLINE# self . document . reporter . error ( msg ) #NEWLINE# return ( '<--- %s --->\n' % msg ) #NEWLINE# #UNINDENT# return ( self . embedded_stylesheet % content ) #NEWLINE# #UNINDENT# if self . settings . stylesheet_path : #NEWLINE# #INDENT# path = utils . relative_path ( self . settings . _destination , path ) #NEWLINE# #UNINDENT# return ( self . stylesheet_link % self . encode ( path ) )