1
0
mirror of https://github.com/venthur/blag.git synced 2025-11-25 20:52:43 +00:00

Fixed unicode problems.

This commit is contained in:
Bastian Venthur
2010-07-25 16:19:47 +02:00
parent 24e86c509d
commit 468bfac272

8
sg.py
View File

@@ -20,6 +20,7 @@ import sys
import os import os
import shutil import shutil
import string import string
import codecs
import markdown import markdown
@@ -60,7 +61,7 @@ def save_page(path, txt):
# create directory if necessairy # create directory if necessairy
if not os.path.exists(os.path.dirname(path)): if not os.path.exists(os.path.dirname(path)):
os.mkdir(os.path.dirname(path)) os.mkdir(os.path.dirname(path))
fh = open(path, 'w') fh = codecs.open(path, 'w', 'utf-8')
fh.write(txt) fh.write(txt)
fh.close() fh.close()
@@ -94,11 +95,12 @@ def render_page(path):
It starts with the file under path, and processes it by pushing it through It starts with the file under path, and processes it by pushing it through
the processing pipeline. It returns a string. the processing pipeline. It returns a string.
""" """
fh = open(path, 'r') print "Rendering", path
fh = codecs.open(path, 'r', 'utf-8')
txt = "".join(fh.readlines()) txt = "".join(fh.readlines())
fh.close() fh.close()
fh = open(os.path.sep.join([LAYOUTS_DIR, 'default.html']), 'r') fh = codecs.open(os.path.sep.join([LAYOUTS_DIR, 'default.html']), 'r', 'utf-8')
template = ''.join(fh.readlines()) template = ''.join(fh.readlines())
fh.close() fh.close()