diff options
Diffstat (limited to 'nikola/plugins/compile/html.py')
| -rw-r--r-- | nikola/plugins/compile/html.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/nikola/plugins/compile/html.py b/nikola/plugins/compile/html.py index fff7f89..24bf385 100644 --- a/nikola/plugins/compile/html.py +++ b/nikola/plugins/compile/html.py @@ -26,14 +26,15 @@ """Implementation of compile_html for HTML source files.""" +from __future__ import unicode_literals + import os import re -import codecs +import io from nikola.plugin_categories import PageCompiler from nikola.utils import makedirs, write_metadata - _META_SEPARATOR = '(' + os.linesep * 2 + '|' + ('\n' * 2) + '|' + ("\r\n" * 2) + ')' @@ -43,8 +44,8 @@ class CompileHtml(PageCompiler): def compile_html(self, source, dest, is_two_file=True): makedirs(os.path.dirname(dest)) - with codecs.open(dest, "w+", "utf8") as out_file: - with codecs.open(source, "r", "utf8") as in_file: + with io.open(dest, "w+", encoding="utf8") as out_file: + with io.open(source, "r", encoding="utf8") as in_file: data = in_file.read() if not is_two_file: data = re.split(_META_SEPARATOR, data, maxsplit=1)[-1] @@ -62,7 +63,7 @@ class CompileHtml(PageCompiler): makedirs(os.path.dirname(path)) if not content.endswith('\n'): content += '\n' - with codecs.open(path, "wb+", "utf8") as fd: + with io.open(path, "w+", encoding="utf8") as fd: if onefile: fd.write('<!--\n') fd.write(write_metadata(metadata)) |
