diff options
| author | 2014-10-21 10:33:15 -0300 | |
|---|---|---|
| committer | 2014-10-21 10:33:15 -0300 | |
| commit | 5ec02211214350ee558fd9f6bb052264fd24f75e (patch) | |
| tree | b61e8c61a95d18a91d053e71dcbd7b30e47552a1 /nikola/plugins/compile/html.py | |
| parent | 58c4878526dec5510f23c812274686787d8724ba (diff) | |
Imported Upstream version 7.1.0upstream/7.1.0
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)) |
