From 607700b2d7bcea3f6ea09d398d0fe6f7cc95e15a Mon Sep 17 00:00:00 2001 From: Bruno Bord Date: Fri, 13 May 2016 00:54:25 +0200 Subject: [PATCH] .htaccess --- CHANGELOG.md | 1 + build.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b145a1..c7fdfa9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * More mobile-friendly layout / font size handling (#19). * French translation of The Black Hack (#10). * Added a `make clean` target to clean the `build/` directory (#22). +* Added a `.htaccess` file to serve `.md` files with the utf-8 encoding (#23). ## 1.0.1 (2016-05-03) diff --git a/build.py b/build.py index 63ed313..aac5ea2 100644 --- a/build.py +++ b/build.py @@ -16,6 +16,10 @@ SOURCE_FILE_TEXT = '

Link to {source_file_basename}

' # noqa +HTACCESS = """ +# Serving .md files as UTF-8. +AddType 'text/plain; charset=UTF-8' md +""".strip() class Builder(object): @@ -188,6 +192,9 @@ def build(self): if os.path.isdir(self.static_path): shutil.rmtree(self.static_path) shutil.copytree('static', self.static_path) + # Write an .htaccess file + with open(join(self.build_path, '.htaccess'), 'w') as fd: + fd.write(HTACCESS) self.main_template = self.get_template(join('templates', 'base.html'))