summaryrefslogtreecommitdiff
path: root/docutils/utils/smartquotes.py
diff options
context:
space:
mode:
authormilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2017-05-04 13:06:23 +0000
committermilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2017-05-04 13:06:23 +0000
commita44b2ea7440b4d4e99d4b1df3b20eeea50ee4e3e (patch)
tree550fe6302b08346a9c89d46f9e82214e90df3d66 /docutils/utils/smartquotes.py
parent62a5972a67b1122f33bc43ce9dc078407a3ba61f (diff)
downloaddocutils-a44b2ea7440b4d4e99d4b1df3b20eeea50ee4e3e.tar.gz
Fix a regression in [r8062] (extra space with French smartquotes again).
git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@8065 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/utils/smartquotes.py')
-rw-r--r--docutils/utils/smartquotes.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/docutils/utils/smartquotes.py b/docutils/utils/smartquotes.py
index c15aa1590..b3e67508b 100644
--- a/docutils/utils/smartquotes.py
+++ b/docutils/utils/smartquotes.py
@@ -30,7 +30,7 @@ typographic punctuation characters.
``smartquotes.py`` is an adaption of "SmartyPants" to Docutils_.
-* Using Unicode instead of HTML entities for typographic punctuation
+* Using Unicode instead of HTML entities for typographic punctuation
characters, it works for any output format that supports Unicode.
* Supports `language specific quote characters`__.
@@ -563,7 +563,7 @@ def educate_tokens(text_tokens, attr=default_smartypants_attr, language='en'):
# skip literal text (math, literal, raw, ...)
if ttype == 'literal':
- prev_token_last_char = text[-1:].replace('"',';').replace("'",';')
+ prev_token_last_char = text[-1:]
yield text
continue
@@ -592,7 +592,10 @@ def educate_tokens(text_tokens, attr=default_smartypants_attr, language='en'):
text = educateSingleBackticks(text, language)
if do_quotes:
- text = educateQuotes(prev_token_last_char+text, language)[1:]
+ # Replace plain quotes to prevent converstion to
+ # 2-character sequence in French.
+ context = prev_token_last_char.replace('"',';').replace("'",';')
+ text = educateQuotes(context+text, language)[1:]
if do_stupefy:
text = stupefyEntities(text, language)