Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjfbu <jfbu@free.fr>2017-05-31 17:00:28 +0300
committerjfbu <jfbu@free.fr>2017-05-31 17:00:28 +0300
commita3bdf1d0dcef1979ea495ecf47ff0ff4835edf84 (patch)
tree9ad2947c9cd3ff94e41c3999c5c1dfaa490388ff /sphinx/util/smartypants.py
parent075a8cfb8f85e25ebb4277f07bc8a051c228fd61 (diff)
Backport Docutils 0.14 skip of backticks processing by SmartQuotes
refs: https://sourceforge.net/p/docutils/mailman/message/35869025/
Diffstat (limited to 'sphinx/util/smartypants.py')
-rw-r--r--sphinx/util/smartypants.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/sphinx/util/smartypants.py b/sphinx/util/smartypants.py
index 2c4fe7d92..10e4d82ea 100644
--- a/sphinx/util/smartypants.py
+++ b/sphinx/util/smartypants.py
@@ -143,12 +143,23 @@ def educateQuotes(text, language='en'):
def educate_tokens(text_tokens, attr='1', language='en'):
# type: (Iterable[Tuple[str, unicode]], unicode, unicode) -> Iterator
"""Return iterator that "educates" the items of `text_tokens`.
+
+ This is modified to intercept the ``attr='2'`` as it was used by the
+ Docutils 0.13.1 SmartQuotes transform in a hard coded way. Docutils 0.14
+ uses ``'qDe'``` and is configurable, and its choice is backported here
+ for use by Sphinx with earlier Docutils releases. Similarly ``'1'`` is
+ replaced by ``'qde'``.
+
+ Use ``attr='qDbe'``, resp. ``'qdbe'`` to recover Docutils effect of ``'2'``,
+ resp. ``'1'``.
+
+ refs: https://sourceforge.net/p/docutils/mailman/message/35869025/
"""
# Parse attributes:
# 0 : do nothing
- # 1 : set all
- # 2 : set all, using old school en- and em- dash shortcuts
+ # 1 : set all (but backticks)
+ # 2 : set all (but backticks), using old school en- and em- dash shortcuts
# 3 : set all, using inverted old school en and em- dash shortcuts
#
# q : quotes
@@ -171,13 +182,13 @@ def educate_tokens(text_tokens, attr='1', language='en'):
pass
elif attr == "1": # Do everything, turn all options on.
do_quotes = True
- do_backticks = 1
+ # do_backticks = 1
do_dashes = 1
do_ellipses = True
elif attr == "2":
# Do everything, turn all options on, use old school dash shorthand.
do_quotes = True
- do_backticks = 1
+ # do_backticks = 1
do_dashes = 2
do_ellipses = True
elif attr == "3":