From e6e8c75dba569558fe228ee46686bc4c7a746335 Mon Sep 17 00:00:00 2001 From: Ryan Kelly Date: Sun, 10 Jul 2011 21:59:58 +1000 Subject: [PATCH] add a custom sphinx builder, so we can get the internal links right --- hyde/ext/plugins/sphinx.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/hyde/ext/plugins/sphinx.py b/hyde/ext/plugins/sphinx.py index 3ccf383..ffa9ce9 100644 --- a/hyde/ext/plugins/sphinx.py +++ b/hyde/ext/plugins/sphinx.py @@ -16,6 +16,8 @@ from hyde.fs import File, Folder from hyde.model import Expando import sphinx +from sphinx.builders.html import JSONHTMLBuilder +from sphinx.util.osutil import SEP class SphinxPlugin(Plugin): @@ -94,7 +96,7 @@ class SphinxPlugin(Plugin): conf_path = self.site.sitepath.child_folder(self.settings.conf_path) sphinx_args = ["sphinx-build"] sphinx_args.extend([ - "-b", "json", + "-b", "hyde_json", "-c", conf_path.path, self.site.content.path, self.sphinx_build_dir.path @@ -108,3 +110,15 @@ class SphinxPlugin(Plugin): with open(self.sphinx_build_dir.child(relpath),"rb") as f: return json.load(f) + + +class HydeJSONHTMLBuilder(JSONHTMLBuilder): + name = "hyde_json" + def get_target_uri(self, docname, typ=None): + return docname + ".html" + + +def setup(app): + app.add_builder(HydeJSONHTMLBuilder) + +