From 0ed09e9c5314290db52de09fe59a688ed3c44009 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Thu, 5 Aug 2010 22:35:12 +0200 Subject: [PATCH] #258: get a bit smarter about closing double quotes. --- sphinx/util/smartypants.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sphinx/util/smartypants.py b/sphinx/util/smartypants.py index 75888ea4d..f83f5689b 100644 --- a/sphinx/util/smartypants.py +++ b/sphinx/util/smartypants.py @@ -83,6 +83,7 @@ def sphinx_smarty_pants(t): # Constants for quote education. punct_class = r"""[!"#\$\%'()*+,-.\/:;<=>?\@\[\\\]\^_`{|}~]""" +end_of_word_class = r"""[\s.,;:!?)]""" close_class = r"""[^\ \t\r\n\[\{\(\-]""" dec_dashes = r"""–|—""" @@ -117,8 +118,8 @@ opening_double_quotes_regex = re.compile(r""" closing_double_quotes_regex = re.compile(r""" #(%s)? # character that indicates the quote should be closing " - (?=\s) - """ % (close_class,), re.VERBOSE) + (?=%s) + """ % (close_class, end_of_word_class), re.VERBOSE) closing_double_quotes_regex_2 = re.compile(r""" (%s) # character that indicates the quote should be closing