Created
July 16, 2012 04:34
-
-
Save troter/3120580 to your computer and use it in GitHub Desktop.
Sphinx extension for raw files, like a CNAME.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sys.path += ['.'] | |
extensions += ['sphinxcontrib_rawfiles'] | |
# Files you want to copy | |
rawfiles = ['CNAME'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import os | |
import shutil | |
def on_html_collect_pages(app): | |
for f in app.builder.config.rawfiles: | |
src = os.path.join(app.srcdir, f) | |
dst = os.path.join(app.builder.outdir, f) | |
if os.path.isfile(src): | |
shutil.copy(src, dst) | |
else: | |
shutil.copytree(src, dst) | |
return () | |
def setup(app): | |
app.add_config_value('rawfiles', [], 'html') | |
app.connect("html-collect-pages", on_html_collect_pages) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment