diff options
author | Jacob Mason <jacoblmason@gmail.com> | 2010-08-07 11:49:38 -0500 |
---|---|---|
committer | Jacob Mason <jacoblmason@gmail.com> | 2010-08-07 11:49:38 -0500 |
commit | 690380b9f0b446866fc35efe8279c092834a5e60 (patch) | |
tree | 5f8c0d5ba0646e1bf652726b9b8f47cd77be5fbf /sphinx/builders/websupport.py | |
parent | 1d98a50bdc5fb6256e2c66d1384267208a15597a (diff) | |
download | sphinx-git-690380b9f0b446866fc35efe8279c092834a5e60.tar.gz |
add DOCUMENTATION_OPTIONS to context
Diffstat (limited to 'sphinx/builders/websupport.py')
-rw-r--r-- | sphinx/builders/websupport.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/sphinx/builders/websupport.py b/sphinx/builders/websupport.py index 095bd5556..70ce5d2bc 100644 --- a/sphinx/builders/websupport.py +++ b/sphinx/builders/websupport.py @@ -11,6 +11,7 @@ import cPickle as pickle from os import path +from cgi import escape import posixpath import shutil from docutils.io import StringOutput @@ -81,7 +82,8 @@ class WebSupportBuilder(StandaloneHTMLBuilder): # Create a dict that will be pickled and used by webapps. doc_ctx = {'body': ctx.get('body', ''), - 'title': ctx.get('title', '')} + 'title': ctx.get('title', ''), + 'DOCUMENTATION_OPTIONS': self._make_doc_options(ctx)} # Partially render the html template to proved a more useful ctx. template = self.templates.environment.get_template(templatename) template_module = template.make_module(ctx) @@ -118,3 +120,17 @@ class WebSupportBuilder(StandaloneHTMLBuilder): def dump_search_index(self): self.indexer.finish_indexing() + + def _make_doc_options(self, ctx): + t = """ +var DOCUMENTATION_OPTIONS = { + URL_ROOT: '%s', + VERSION: '%s', + COLLAPSE_INDEX: false, + FILE_SUFFIX: '', + HAS_SOURCE: '%s' +};""" + return t % (ctx.get('url_root', ''), escape(ctx['release']), + str(ctx['has_source']).lower()) + + |