Deprecate the html_use_smartypants option

This commit is contained in:
Dmitry Shachnev 2017-04-17 14:15:28 +03:00
parent 4f4014c7c0
commit 9236beb9ee
3 changed files with 15 additions and 3 deletions

View File

@ -768,6 +768,12 @@ that use Sphinx's HTMLWriter class.
will be used to convert quotes and dashes to typographically correct
entities. Default: ``True``.
.. deprecated:: 1.6
Use the `smart_quotes option`_ in the Docutils configuration file
(``docutils.conf``) instead.
.. _`smart_quotes option`: http://docutils.sourceforge.net/docs/user/config.html#smart-quotes
.. confval:: html_add_permalinks
Sphinx will add "permalinks" for each heading and description environment as

View File

@ -1312,7 +1312,7 @@ def setup(app):
app.add_config_value('html_static_path', [], 'html')
app.add_config_value('html_extra_path', [], 'html')
app.add_config_value('html_last_updated_fmt', None, 'html', string_classes)
app.add_config_value('html_use_smartypants', True, 'html')
app.add_config_value('html_use_smartypants', None, 'html')
app.add_config_value('html_sidebars', {}, 'html')
app.add_config_value('html_additional_pages', {}, 'html')
app.add_config_value('html_domain_indices', True, 'html', [list])

View File

@ -674,8 +674,14 @@ class BuildEnvironment(object):
self.settings['gettext_compact'] = self.config.gettext_compact
language = (self.config.language or 'en').replace('_', '-')
self.settings['language_code'] = language
if language in smartchars.quotes:
self.settings['smart_quotes'] = self.config.html_use_smartypants
if self.config.html_use_smartypants is not None:
warnings.warn("html_use_smartypants option is deprecated. Use the "
"smart_quotes option in docutils.conf instead.",
RemovedInSphinx17Warning)
if language in smartchars.quotes:
self.settings['smart_quotes'] = self.config.html_use_smartypants
elif language in smartchars.quotes: # We enable smartypants by default
self.settings['smart_quotes'] = True
docutilsconf = path.join(self.srcdir, 'docutils.conf')
# read docutils.conf from source dir, not from current dir