Drop deprecated options for html builder

This commit is contained in:
Takeshi KOMIYA 2017-01-01 22:58:14 +09:00
parent 5d715cb148
commit 431d865d4a
6 changed files with 3 additions and 72 deletions

View File

@ -852,13 +852,6 @@ that use Sphinx's HTMLWriter class.
.. versionadded:: 1.0 .. versionadded:: 1.0
.. confval:: html_use_modindex
If true, add a module index to the HTML documents. Default is ``True``.
.. deprecated:: 1.0
Use :confval:`html_domain_indices`.
.. confval:: html_use_index .. confval:: html_use_index
If true, add an index to the HTML documents. Default is ``True``. If true, add an index to the HTML documents. Default is ``True``.
@ -921,20 +914,6 @@ that use Sphinx's HTMLWriter class.
.. versionadded:: 0.6 .. versionadded:: 0.6
.. confval:: html_translator_class
A string with the fully-qualified name of a HTML Translator class, that is, a
subclass of Sphinx's :class:`~sphinx.writers.html.HTMLTranslator`, that is
used to translate document trees to HTML. Default is ``None`` (use the
builtin translator).
.. seealso:: :meth:`~sphinx.application.Sphinx.set_translator`
.. deprecated:: 1.5
Implement your translator as extension and use `Sphinx.set_translator`
instead.
.. confval:: html_show_copyright .. confval:: html_show_copyright
If true, "(C) Copyright ..." is shown in the HTML footer. Default is If true, "(C) Copyright ..." is shown in the HTML footer. Default is

View File

@ -89,11 +89,6 @@ package.
This allows extensions to use custom translator and define custom This allows extensions to use custom translator and define custom
nodes for the translator (see :meth:`add_node`). nodes for the translator (see :meth:`add_node`).
This is a API version of :confval:`html_translator_class` for all other
builders. Note that if :confval:`html_translator_class` is specified and
this API is called for html related builders, API overriding takes
precedence.
.. versionadded:: 1.3 .. versionadded:: 1.3
.. method:: Sphinx.add_node(node, **kwds) .. method:: Sphinx.add_node(node, **kwds)

View File

@ -189,12 +189,6 @@ class Sphinx(object):
'This project needs at least Sphinx v%s and therefore cannot ' 'This project needs at least Sphinx v%s and therefore cannot '
'be built with this version.' % self.config.needs_sphinx) 'be built with this version.' % self.config.needs_sphinx)
# force preload html_translator_class
if self.config.html_translator_class:
translator_class = self.import_object(self.config.html_translator_class,
'html_translator_class setting')
self.set_translator('html', translator_class)
# set confdir to srcdir if -C given (!= no confdir); a few pieces # set confdir to srcdir if -C given (!= no confdir); a few pieces
# of code expect a confdir to be set # of code expect a confdir to be set
if self.confdir is None: if self.confdir is None:

View File

@ -301,10 +301,6 @@ class StandaloneHTMLBuilder(Builder):
if isinstance(indices_config, list): if isinstance(indices_config, list):
if indexname not in indices_config: if indexname not in indices_config:
continue continue
# deprecated config value
if indexname == 'py-modindex' and \
not self.config.html_use_modindex:
continue
content, collapse = indexcls(domain).generate() content, collapse = indexcls(domain).generate()
if content: if content:
self.domain_indices.append( self.domain_indices.append(
@ -1267,13 +1263,6 @@ class JSONHTMLBuilder(SerializingHTMLBuilder):
SerializingHTMLBuilder.init(self) SerializingHTMLBuilder.init(self)
def validate_config_values(app):
# type: (Sphinx) -> None
if app.config.html_translator_class:
logger.warning('html_translator_class is deprecated. '
'Use Sphinx.set_translator() API instead.')
def setup(app): def setup(app):
# type: (Sphinx) -> Dict[unicode, Any] # type: (Sphinx) -> Dict[unicode, Any]
# builders # builders
@ -1283,8 +1272,6 @@ def setup(app):
app.add_builder(PickleHTMLBuilder) app.add_builder(PickleHTMLBuilder)
app.add_builder(JSONHTMLBuilder) app.add_builder(JSONHTMLBuilder)
app.connect('builder-inited', validate_config_values)
# config values # config values
app.add_config_value('html_theme', 'alabaster', 'html') app.add_config_value('html_theme', 'alabaster', 'html')
app.add_config_value('html_theme_path', [], 'html') app.add_config_value('html_theme_path', [], 'html')
@ -1302,7 +1289,6 @@ def setup(app):
app.add_config_value('html_use_smartypants', True, 'html') app.add_config_value('html_use_smartypants', True, 'html')
app.add_config_value('html_sidebars', {}, 'html') app.add_config_value('html_sidebars', {}, 'html')
app.add_config_value('html_additional_pages', {}, 'html') app.add_config_value('html_additional_pages', {}, 'html')
app.add_config_value('html_use_modindex', True, 'html') # deprecated
app.add_config_value('html_domain_indices', True, 'html', [list]) app.add_config_value('html_domain_indices', True, 'html', [list])
app.add_config_value('html_add_permalinks', u'\u00B6', 'html') app.add_config_value('html_add_permalinks', u'\u00B6', 'html')
app.add_config_value('html_use_index', True, 'html') app.add_config_value('html_use_index', True, 'html')

View File

@ -124,9 +124,6 @@ class Config(object):
tls_verify = (True, 'env'), tls_verify = (True, 'env'),
tls_cacerts = (None, 'env'), tls_cacerts = (None, 'env'),
# pre-initialized confval for HTML builder
html_translator_class = (None, 'html', string_classes),
) # type: Dict[unicode, Tuple] ) # type: Dict[unicode, Tuple]
def __init__(self, dirname, filename, overrides, tags): def __init__(self, dirname, filename, overrides, tags):
@ -250,7 +247,7 @@ class Config(object):
def pre_init_values(self): def pre_init_values(self):
# type: () -> None # type: () -> None
"""Initialize some limited config variables before loading extensions""" """Initialize some limited config variables before loading extensions"""
variables = ['needs_sphinx', 'suppress_warnings', 'html_translator_class'] variables = ['needs_sphinx', 'suppress_warnings']
for name in variables: for name in variables:
try: try:
if name in self.overrides: if name in self.overrides:

View File

@ -24,21 +24,12 @@ def teardown_module():
@with_app('html') @with_app('html')
def test_html_translator(app, status, warning): def test_html_translator(app, status, warning):
# no set_translator(), no html_translator_class # no set_translator()
translator_class = app.builder.translator_class translator_class = app.builder.translator_class
assert translator_class assert translator_class
assert translator_class.__name__ == 'SmartyPantsHTMLTranslator' assert translator_class.__name__ == 'SmartyPantsHTMLTranslator'
@with_app('html', confoverrides={
'html_translator_class': 'translator.ExtHTMLTranslator'})
def test_html_with_html_translator_class(app, status, warning):
# no set_translator(), but html_translator_class
translator_class = app.builder.translator_class
assert translator_class
assert translator_class.__name__ == 'ExtHTMLTranslator'
@with_app('html', @with_app('html',
confoverrides={'html_use_smartypants': False}) confoverrides={'html_use_smartypants': False})
def test_html_with_smartypants(app, status, warning): def test_html_with_smartypants(app, status, warning):
@ -50,18 +41,7 @@ def test_html_with_smartypants(app, status, warning):
@with_app('html', testroot='api-set-translator') @with_app('html', testroot='api-set-translator')
def test_html_with_set_translator_for_html_(app, status, warning): def test_html_with_set_translator_for_html_(app, status, warning):
# use set_translator(), no html_translator_class # use set_translator()
translator_class = app.builder.translator_class
assert translator_class
assert translator_class.__name__ == 'ConfHTMLTranslator'
@with_app('html', testroot='api-set-translator',
confoverrides={'html_translator_class': 'translator.ExtHTMLTranslator'})
def test_html_with_set_translator_for_html_and_html_translator_class(
app, status, warning):
# use set_translator() and html_translator_class.
# set_translator() is given priority over html_translator_clas.
translator_class = app.builder.translator_class translator_class = app.builder.translator_class
assert translator_class assert translator_class
assert translator_class.__name__ == 'ConfHTMLTranslator' assert translator_class.__name__ == 'ConfHTMLTranslator'