comparison util/generate_benchsite.py @ 490:4a9047850657

cm: Fix benchmark website generation on Windows.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 22 Jul 2015 22:20:35 -0700
parents 1038dba7b46e
children
comparison
equal deleted inserted replaced
489:186a29f61ddc 490:4a9047850657
147 if not os.path.isdir(posts_dir): 147 if not os.path.isdir(posts_dir):
148 os.makedirs(posts_dir) 148 os.makedirs(posts_dir)
149 149
150 def writePost(self, post_info): 150 def writePost(self, post_info):
151 out_dir = os.path.join(self.out_dir, 'content', 'post') 151 out_dir = os.path.join(self.out_dir, 'content', 'post')
152 dtstr = post_info['datetime'].strftime('%Y-%m-%d_%H-%M-%S-00:00') 152 dtstr = post_info['datetime'].strftime('%Y-%m-%d_%H-%M-%S')
153 with open('%s/%s.md' % (out_dir, dtstr), 'w', 153 post_path = os.path.join(out_dir, '%s.md' % dtstr)
154 encoding='utf8') as f: 154 with open(post_path, 'w', encoding='utf8') as f:
155 f.write('+++\n') 155 f.write('+++\n')
156 f.write('title = "%s"\n' % post_info['title']) 156 f.write('title = "%s"\n' % post_info['title'])
157 f.write('description = "%s"\n' % post_info['description']) 157 f.write('description = "%s"\n' % post_info['description'])
158 f.write('categories = [\n "%s"\n]\n' % post_info['tags']) 158 f.write('categories = [\n "%s"\n]\n' % post_info['tags'])
159 f.write('date = "%s"\n' % post_info['datetime'].strftime( 159 f.write('date = "%s"\n' % post_info['datetime'].strftime(