diff options
Diffstat (limited to 'docutils/utils/smartquotes.py')
| -rw-r--r-- | docutils/utils/smartquotes.py | 9 |
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) |
