Template dirs are relative to the root.

This commit is contained in:
Georg Brandl 2008-03-12 21:07:53 +00:00
parent 6aae7cf9ff
commit 19df48d2cb
2 changed files with 10 additions and 5 deletions

View File

@ -80,7 +80,9 @@ class Builder(object):
# load templates # load templates
self.templates = {} self.templates = {}
base_templates_path = path.join(path.dirname(__file__), 'templates') base_templates_path = path.join(path.dirname(__file__), 'templates')
loader = SphinxFileSystemLoader(base_templates_path, self.config.templates_path) ext_templates_path = [path.join(self.srcdir, dir)
for dir in self.config.templates_path]
loader = SphinxFileSystemLoader(base_templates_path, ext_templates_path)
self.jinja_env = Environment(loader=loader, self.jinja_env = Environment(loader=loader,
# disable traceback, more likely that something # disable traceback, more likely that something
# in the application is broken than in the templates # in the application is broken than in the templates

View File

@ -278,9 +278,10 @@ document is a custom template, you can also set this to another filename.'''
mkdir_p(srcdir) mkdir_p(srcdir)
if separate: if separate:
mkdir_p(path.join(d['path'], 'build')) builddir = path.join(d['path'], 'build')
else: else:
mkdir_p(path.join(srcdir, d['dot'] + 'build')) builddir = path.join(srcdir, d['dot'] + 'build')
mkdir_p(builddir)
mkdir_p(path.join(srcdir, d['dot'] + 'templates')) mkdir_p(path.join(srcdir, d['dot'] + 'templates'))
mkdir_p(path.join(srcdir, d['dot'] + 'static')) mkdir_p(path.join(srcdir, d['dot'] + 'static'))
@ -297,8 +298,10 @@ document is a custom template, you can also set this to another filename.'''
print bold('Finished: An initial directory structure has been created.') print bold('Finished: An initial directory structure has been created.')
print ''' print '''
You should now populate your master file %s and create other documentation You should now populate your master file %s and create other documentation
source files. Use the sphinx-build.py script to build the docs. source files. Use the sphinx-build.py script to build the docs, like so:
''' % (masterfile)
sphinx-build.py -b <builder> %s %s
''' % (masterfile, srcdir, builddir)
def main(argv=sys.argv): def main(argv=sys.argv):