|
@@ -16,6 +16,8 @@ from hyde.fs import File, Folder |
|
|
from hyde.model import Expando |
|
|
from hyde.model import Expando |
|
|
|
|
|
|
|
|
import sphinx |
|
|
import sphinx |
|
|
|
|
|
from sphinx.builders.html import JSONHTMLBuilder |
|
|
|
|
|
from sphinx.util.osutil import SEP |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SphinxPlugin(Plugin): |
|
|
class SphinxPlugin(Plugin): |
|
@@ -94,7 +96,7 @@ class SphinxPlugin(Plugin): |
|
|
conf_path = self.site.sitepath.child_folder(self.settings.conf_path) |
|
|
conf_path = self.site.sitepath.child_folder(self.settings.conf_path) |
|
|
sphinx_args = ["sphinx-build"] |
|
|
sphinx_args = ["sphinx-build"] |
|
|
sphinx_args.extend([ |
|
|
sphinx_args.extend([ |
|
|
"-b", "json", |
|
|
|
|
|
|
|
|
"-b", "hyde_json", |
|
|
"-c", conf_path.path, |
|
|
"-c", conf_path.path, |
|
|
self.site.content.path, |
|
|
self.site.content.path, |
|
|
self.sphinx_build_dir.path |
|
|
self.sphinx_build_dir.path |
|
@@ -108,3 +110,15 @@ class SphinxPlugin(Plugin): |
|
|
with open(self.sphinx_build_dir.child(relpath),"rb") as f: |
|
|
with open(self.sphinx_build_dir.child(relpath),"rb") as f: |
|
|
return json.load(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) |
|
|
|
|
|
|
|
|
|
|
|
|