mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Add :confval:smart_quotes
to disable smart quotes through `conf.py
` (refs: #4142)
This commit is contained in:
parent
e45b03dd50
commit
bfd39c12b2
2
CHANGES
2
CHANGES
@ -14,6 +14,8 @@ Features added
|
|||||||
--------------
|
--------------
|
||||||
|
|
||||||
* #4181: autodoc: Sort dictionary keys when possible
|
* #4181: autodoc: Sort dictionary keys when possible
|
||||||
|
* Add :confval:`smart_quotes` to disable smart quotes through ``conf.py``
|
||||||
|
(refs: #3967)
|
||||||
|
|
||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
|
@ -27,7 +27,6 @@ and output behavior.
|
|||||||
The configuration file is executed as Python code at build time (using
|
The configuration file is executed as Python code at build time (using
|
||||||
:func:`execfile`, and with the current directory set to its containing
|
:func:`execfile`, and with the current directory set to its containing
|
||||||
directory), and therefore can execute arbitrarily complex code. Sphinx then
|
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:
|
Important points to note:
|
||||||
|
|
||||||
@ -345,6 +344,14 @@ General configuration
|
|||||||
|
|
||||||
.. versionadded:: 1.3
|
.. versionadded:: 1.3
|
||||||
|
|
||||||
|
.. confval:: smart_quotes
|
||||||
|
|
||||||
|
If true, `SmartyPants <https://daringfireball.net/projects/smartypants/>`_
|
||||||
|
will be used to convert quotes and dashes to typographically correct
|
||||||
|
entities. Default: ``True``.
|
||||||
|
|
||||||
|
.. versionadded:: 1.6.6
|
||||||
|
|
||||||
.. confval:: tls_verify
|
.. confval:: tls_verify
|
||||||
|
|
||||||
If true, Sphinx verifies server certifications. Default is ``True``.
|
If true, Sphinx verifies server certifications. Default is ``True``.
|
||||||
@ -781,8 +788,9 @@ that use Sphinx's HTMLWriter class.
|
|||||||
entities. Default: ``True``.
|
entities. Default: ``True``.
|
||||||
|
|
||||||
.. deprecated:: 1.6
|
.. deprecated:: 1.6
|
||||||
To disable or customize smart quotes, use the Docutils configuration file
|
To disable smart quotes, use :confval:`smart_quotes` or the Docutils
|
||||||
(``docutils.conf``) instead to set there its `smart_quotes option`_.
|
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
|
.. _`smart_quotes option`: http://docutils.sourceforge.net/docs/user/config.html#smart-quotes
|
||||||
|
|
||||||
|
@ -132,6 +132,7 @@ class Config(object):
|
|||||||
|
|
||||||
tls_verify = (True, 'env'),
|
tls_verify = (True, 'env'),
|
||||||
tls_cacerts = (None, 'env'),
|
tls_cacerts = (None, 'env'),
|
||||||
|
smart_quotes = (True, 'env'),
|
||||||
) # type: Dict[unicode, Tuple]
|
) # type: Dict[unicode, Tuple]
|
||||||
|
|
||||||
def __init__(self, dirname, filename, overrides, tags):
|
def __init__(self, dirname, filename, overrides, tags):
|
||||||
|
@ -677,14 +677,15 @@ class BuildEnvironment(object):
|
|||||||
language = self.config.language or 'en'
|
language = self.config.language or 'en'
|
||||||
self.settings['language_code'] = language
|
self.settings['language_code'] = language
|
||||||
if 'smart_quotes' not in self.settings:
|
if 'smart_quotes' not in self.settings:
|
||||||
self.settings['smart_quotes'] = True
|
|
||||||
if self.config.html_use_smartypants is not None:
|
if self.config.html_use_smartypants is not None:
|
||||||
warnings.warn("html_use_smartypants option is deprecated. Smart "
|
warnings.warn("html_use_smartypants option is deprecated. Smart "
|
||||||
"quotes are on by default; if you want to disable "
|
"quotes are on by default; if you want to disable "
|
||||||
"or customize them, use the smart_quotes option in "
|
"them, use the smart_quotes option",
|
||||||
"docutils.conf.",
|
|
||||||
RemovedInSphinx17Warning)
|
RemovedInSphinx17Warning)
|
||||||
self.settings['smart_quotes'] = self.config.html_use_smartypants
|
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):
|
for tag in normalize_language_tag(language):
|
||||||
if tag in smartchars.quotes:
|
if tag in smartchars.quotes:
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user