Skip to content

Commit

Permalink
Merge pull request #23 from brunobord/htaccess
Browse files Browse the repository at this point in the history
.htaccess for Apache to serve utf8
  • Loading branch information
brunobord committed May 13, 2016
2 parents c320bfd + 607700b commit d0de8ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
7 changes: 7 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@


SOURCE_FILE_TEXT = '<p><a href="{source_file}">Link to {source_file_basename}</a></p>' # noqa
HTACCESS = """
# Serving .md files as UTF-8.
AddType 'text/plain; charset=UTF-8' md
""".strip()


class Builder(object):
Expand Down Expand Up @@ -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'))

Expand Down

0 comments on commit d0de8ad

Please sign in to comment.