From a44b2ea7440b4d4e99d4b1df3b20eeea50ee4e3e Mon Sep 17 00:00:00 2001 From: milde Date: Thu, 4 May 2017 13:06:23 +0000 Subject: 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 --- docutils/utils/smartquotes.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'docutils') 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) -- cgit v1.2.1