diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2016-01-02 22:02:21 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2016-01-06 22:14:57 +0900 |
commit | 0ea518d563c4fcf2d1f9c694749f8a917e5a4198 (patch) | |
tree | 510cdce35d76b700d5f61fccb948eb75b9ffb3ae /sphinx/ext/githubpages.py | |
parent | ddf6acd33c31af56738566363efc0ac21396a1fe (diff) | |
download | sphinx-git-0ea518d563c4fcf2d1f9c694749f8a917e5a4198.tar.gz |
Add sphinx.ext.githubpages to publish the docs on GitHub Pages
Diffstat (limited to 'sphinx/ext/githubpages.py')
-rw-r--r-- | sphinx/ext/githubpages.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sphinx/ext/githubpages.py b/sphinx/ext/githubpages.py new file mode 100644 index 000000000..17b858a32 --- /dev/null +++ b/sphinx/ext/githubpages.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +""" + sphinx.ext.githubpages + ~~~~~~~~~~~~~~~~~~~~~~ + + To publish HTML docs at GitHub Pages, create .nojekyll file. + + :copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import os +import sphinx + + +def create_nojekyll(app, env): + if app.builder.format == 'html': + path = os.path.join(app.builder.outdir, '.nojekyll') + open(path, 'wt').close() + + +def setup(app): + app.connect('env-updated', create_nojekyll) + return {'version': sphinx.__display_version__, 'parallel_read_safe': True} |