@contextmanager
def pelican_open(filename, mode=u'rb', strip_crs=(sys.platform == u'win32')):
 with codecs.open(filename, mode, encoding=u'utf-8') as infile:
  content = infile.read()
 if (content[:1] == codecs.BOM_UTF8.decode(u'utf8')):
  content = content[1:]
 if strip_crs:
  content = content.replace(u'\r\n', u'\n')
 (yield content)

@ contextmanager def pelican_open ( filename , mode = u'rb' , strip_crs = ( sys . platform == u'win32' ) ) : with codecs . open ( filename , mode , encoding = u'utf-8' ) as infile : content = infile . read ( ) if ( content [ : 1 ] == codecs . BOM_UTF8 . decode ( u'utf8' ) ) : content = content [ 1 : ] if strip_crs : content = content . replace ( u'\r\n' , u'\n' ) ( yield content )
open a file and return its content .