diff --git a/CHANGES b/CHANGES index 1d05abd57..d7250ae15 100644 --- a/CHANGES +++ b/CHANGES @@ -14,6 +14,8 @@ Features added -------------- * #4181: autodoc: Sort dictionary keys when possible +* Add :confval:`smart_quotes` to disable smart quotes through ``conf.py`` + (refs: #3967) Bugs fixed ---------- diff --git a/doc/config.rst b/doc/config.rst index b615dc45a..dca199652 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -27,7 +27,6 @@ and output behavior. The configuration file is executed as Python code at build time (using :func:`execfile`, and with the current directory set to its containing directory), and therefore can execute arbitrarily complex code. Sphinx then -reads simple names from the file's namespace as its configuration. Important points to note: @@ -345,6 +344,14 @@ General configuration .. versionadded:: 1.3 +.. confval:: smart_quotes + + If true, `SmartyPants `_ + will be used to convert quotes and dashes to typographically correct + entities. Default: ``True``. + + .. versionadded:: 1.6.6 + .. confval:: tls_verify If true, Sphinx verifies server certifications. Default is ``True``. @@ -781,8 +788,9 @@ that use Sphinx's HTMLWriter class. entities. Default: ``True``. .. deprecated:: 1.6 - To disable or customize smart quotes, use the Docutils configuration file - (``docutils.conf``) instead to set there its `smart_quotes option`_. + To disable smart quotes, use :confval:`smart_quotes` or the Docutils + configuration file (``docutils.conf``) instead to set there its + `smart_quotes option`_. .. _`smart_quotes option`: http://docutils.sourceforge.net/docs/user/config.html#smart-quotes diff --git a/sphinx/config.py b/sphinx/config.py index 02ee529a3..5308c52bf 100644 --- a/sphinx/config.py +++ b/sphinx/config.py @@ -132,6 +132,7 @@ class Config(object): tls_verify = (True, 'env'), tls_cacerts = (None, 'env'), + smart_quotes = (True, 'env'), ) # type: Dict[unicode, Tuple] def __init__(self, dirname, filename, overrides, tags): diff --git a/sphinx/environment/__init__.py b/sphinx/environment/__init__.py index f522bd576..553ab794c 100644 --- a/sphinx/environment/__init__.py +++ b/sphinx/environment/__init__.py @@ -677,14 +677,15 @@ class BuildEnvironment(object): language = self.config.language or 'en' self.settings['language_code'] = language if 'smart_quotes' not in self.settings: - self.settings['smart_quotes'] = True if self.config.html_use_smartypants is not None: warnings.warn("html_use_smartypants option is deprecated. Smart " "quotes are on by default; if you want to disable " - "or customize them, use the smart_quotes option in " - "docutils.conf.", + "them, use the smart_quotes option", RemovedInSphinx17Warning) self.settings['smart_quotes'] = self.config.html_use_smartypants + else: + self.settings['smart_quotes'] = self.config.smart_quotes + for tag in normalize_language_tag(language): if tag in smartchars.quotes: break