summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/bupa20
1 files changed, 10 insertions, 10 deletions
diff --git a/scripts/bupa b/scripts/bupa
index ff8d5d1..6770b48 100755
--- a/scripts/bupa
+++ b/scripts/bupa
@@ -30,8 +30,8 @@ class Page(object):
self.body = page_dict['body'][0]
def parse(filename):
- with open(filename, 'r') as file:
- data = file.read()
+ with open(filename, 'rb') as file:
+ data = file.read().decode('utf-8')
frontmatter, *body = data.split('\n\n', 1)
frontmatter = frontmatter.partition('\n')[2]
@@ -69,9 +69,9 @@ def build_journal(env):
entry.page = file.split('/', 1)[1].split('.', 1)[0] + '.html'
entry.body = reST_to_html(entry.body)
entries += [entry]
- with open('build/'+entry.page, 'w') as file:
+ with open('build/'+entry.page, 'wb') as file:
file.write(entry_tmpl.render(entry=entry, title='~/journal',
- header='The lost journal'))
+ header='The lost journal').encode('utf-8'))
feed.add(
title=entry.title,
content=entry.body,
@@ -81,11 +81,11 @@ def build_journal(env):
updated=entry.date
)
- with open('build/journal.html', 'w') as file:
+ with open('build/journal.html', 'wb') as file:
file.write(template.render(entries=entries, title='~/journal',
- header='The lost journal'))
- with open('build/journal.xml', 'w') as file:
- file.write(feed.to_string())
+ header='The lost journal').encode('utf-8'))
+ with open('build/journal.xml', 'wb') as file:
+ file.write(feed.to_string().encode('utf-8'))
def build_page(env, templ_name, pagename):
template = env.get_template(templ_name)
@@ -94,8 +94,8 @@ def build_page(env, templ_name, pagename):
page.body = reST_to_html(page.body)
page.article_id = pagename
- with open('build/'+pagename+'.html', 'w') as file:
- file.write(template.render(page=page, title=page.title, header=page.header))
+ with open('build/'+pagename+'.html', 'wb') as file:
+ file.write(template.render(page=page, title=page.title, header=page.header).encode('utf-8'))
def main():
arguments = docopt.docopt(__doc__)