diff --git a/readthedocs_ext/comments/builder.py b/readthedocs_ext/comments/builder.py index e21e1ac..aea5086 100644 --- a/readthedocs_ext/comments/builder.py +++ b/readthedocs_ext/comments/builder.py @@ -40,14 +40,14 @@ def finalize_comment_media(app): class CommentsBuilderMixin(BuilderMixin): - static_override_files = [ + static_readthedocs_files = [ 'sphinxweb.css', 'jquery.pageslide.css', 'jquery.pageslide.js', ] - def get_static_override_context(self): - ctx = super(CommentsBuilderMixin, self).get_static_override_context() + def get_static_readthedocs_context(self): + ctx = super(CommentsBuilderMixin, self).get_static_readthedocs_context() ctx['websupport2_base_url'] = self.config.websupport2_base_url ctx['websupport2_static_url'] = self.config.websupport2_static_url return ctx diff --git a/readthedocs_ext/mixins.py b/readthedocs_ext/mixins.py index d3d90c4..4b0b04e 100644 --- a/readthedocs_ext/mixins.py +++ b/readthedocs_ext/mixins.py @@ -19,21 +19,21 @@ class BuilderMixin(object): # pylint: disable=old-style-class new path. """ - static_override_files = [] + static_readthedocs_files = [] - def get_static_override_context(self): + def get_static_readthedocs_context(self): return self.globalcontext.copy() - def copy_static_override_files(self): - self.app.info(bold('copying static override files... '), nonl=True) - for filename in self.static_override_files: + def copy_static_readthedocs_files(self): + self.app.info(bold('copying readthedocs static files... '), nonl=True) + for filename in self.static_readthedocs_files: path_dest = os.path.join(self.outdir, '_static') path_src = os.path.join( os.path.abspath(os.path.dirname(__file__)), '_static', filename ) - ctx = self.get_static_override_context() + ctx = self.get_static_readthedocs_context() if sphinx.version_info < (1, 5): copy_static_entry( path_src, @@ -51,10 +51,10 @@ def copy_static_override_files(self): self.app.info('done') def copy_static_files(self): - """Copy override files after initial static pass + """Copy Read the Docs specific files after initial static pass This overrides the base builder ``copy_static_files`` method to inject custom static files. """ super(BuilderMixin, self).copy_static_files() - self.copy_static_override_files() + self.copy_static_readthedocs_files() diff --git a/readthedocs_ext/readthedocs.py b/readthedocs_ext/readthedocs.py index ede7c88..e4dee4d 100644 --- a/readthedocs_ext/readthedocs.py +++ b/readthedocs_ext/readthedocs.py @@ -115,7 +115,7 @@ def rtd_render(self, template, render_context): class HtmlBuilderMixin(BuilderMixin): - static_override_files = [ + static_readthedocs_files = [ 'readthedocs-dynamic-include.js_t', 'readthedocs-data.js_t', # We patch searchtools and copy it with a special handler @@ -132,14 +132,14 @@ class HtmlBuilderMixin(BuilderMixin): (re.MULTILINE | re.VERBOSE) ) - def get_static_override_context(self): - ctx = super(HtmlBuilderMixin, self).get_static_override_context() + def get_static_readthedocs_context(self): + ctx = super(HtmlBuilderMixin, self).get_static_readthedocs_context() if self.indexer is not None: ctx.update(self.indexer.context_for_searchtool()) return ctx - def copy_static_override_files(self): - super(HtmlBuilderMixin, self).copy_static_override_files() + def copy_static_readthedocs_files(self): + super(HtmlBuilderMixin, self).copy_static_readthedocs_files() self._copy_searchtools() def _copy_searchtools(self, renderer=None): @@ -171,7 +171,7 @@ def _copy_searchtools(self, renderer=None): data = self.REPLACEMENT_PATTERN.sub(self.REPLACEMENT_TEXT, data) h_dest.write(renderer.render_string( data, - self.get_static_override_context() + self.get_static_readthedocs_context() )) else: self.app.warn('Missing searchtools.js_t') diff --git a/tests/test_mixins.py b/tests/test_mixins.py index 1a2d143..46eafe9 100644 --- a/tests/test_mixins.py +++ b/tests/test_mixins.py @@ -9,23 +9,23 @@ class MixinTests(unittest.TestCase): - def test_html_builder_context_contains_overrides(self): + def test_html_builder_context_contains_additions(self): with sphinx_build('pyexample', 'readthedocs') as app: self.assertIn( 'search_scorer_tool', - app.builder.get_static_override_context(), + app.builder.get_static_readthedocs_context(), ) - def test_htmldir_builder_context_contains_overrides(self): + def test_htmldir_builder_context_contains_additions(self): with sphinx_build('pyexample', 'readthedocsdirhtml') as app: self.assertIn( 'search_scorer_tool', - app.builder.get_static_override_context(), + app.builder.get_static_readthedocs_context(), ) - def test_comments_builder_context_contains_overrides(self): + def test_comments_builder_context_contains_additions(self): with sphinx_build('pyexample', 'readthedocs-comments') as app: self.assertIn( 'websupport2_base_url', - app.builder.get_static_override_context(), + app.builder.get_static_readthedocs_context(), ) diff --git a/tox.ini b/tox.ini index d3fd1c9..698c466 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py{27,35,36}-sphinx{13,14,15} + py{27,35,36}-sphinx{13,14,15,16} lint [testenv] @@ -13,6 +13,7 @@ deps = sphinx13: Sphinx<1.4 sphinx14: Sphinx<1.5 sphinx15: Sphinx<1.6 + sphinx16: Sphinx<1.7 commands = py.test {posargs}