Browse Source

add a custom sphinx builder, so we can get the internal links right

main
Ryan Kelly 13 years ago
parent
commit
e6e8c75dba
1 changed files with 15 additions and 1 deletions
  1. +15
    -1
      hyde/ext/plugins/sphinx.py

+ 15
- 1
hyde/ext/plugins/sphinx.py View File

@@ -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)



Loading…
Cancel
Save