diff options
author | Yu-Jie Lin <livibetter@gmail.com> | 2013-08-28 16:02:41 +0800 |
---|---|---|
committer | Yu-Jie Lin <livibetter@gmail.com> | 2013-08-28 16:02:41 +0800 |
commit | 106db552c20c65c2b8bff3ef1ffd37e6a154a5a2 (patch) | |
tree | 509ab90e5a0d900ba4366783e0184a0326bb0e8f | |
parent | 96e7daeaf178c8460547c8358dad001eea6d61e4 (diff) | |
download | smartypants-106db552c20c65c2b8bff3ef1ffd37e6a154a5a2.tar.gz |
fix --- being converted in educateDashes
The original Perl smartypants.pl does not do such conversion. The ``---``
convsersion was added in v1.5_1.5 (eed4a8a16f11).
-rw-r--r-- | CHANGES.rst | 7 | ||||
-rwxr-xr-x | smartypants.py | 3 | ||||
-rw-r--r-- | tests/test.py | 2 |
3 files changed, 9 insertions, 3 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index e47dab2..19ae366 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -17,6 +17,13 @@ development: - add ``doc`` for documentation generation - add ``upload_doc`` for uploading to PyPI - add ``clean`` for cleaning up built files + - fix ``---`` being converted in ``educateDashes`` + + The Perl doesn't do such, and it's possibly a mistaken in + version v1.5_1.5 (eed4a8a16f11). + + If you want the same behavior with default attributes, you need to use + ``Attr.q | Attr.b | Attr.i | Attr.e``. 1.8.1: 2013-08-20T02:27:35Z diff --git a/smartypants.py b/smartypants.py index 9e4d038..33e5e94 100755 --- a/smartypants.py +++ b/smartypants.py @@ -488,8 +488,7 @@ def educateDashes(text): Convert ``--`` in *text* into em-dash HTML entities. """ - text = re.sub('---', '–', text) # en (yes, backwards) - text = re.sub('--', '—', text) # em (yes, backwards) + text = re.sub('--', '—', text) return text diff --git a/tests/test.py b/tests/test.py index 549b19f..ffd20ac 100644 --- a/tests/test.py +++ b/tests/test.py @@ -35,7 +35,7 @@ class SmartyPantsTestCase(unittest.TestCase): self.assertEqual(sp("1440-80's"), "1440-80’s") self.assertEqual(sp("1440-'80s"), "1440-‘80s") - self.assertEqual(sp("1440---'80s"), "1440–‘80s") + self.assertEqual(sp("1440--'80s"), "1440—‘80s") self.assertEqual(sp("1960s"), "1960s") # no effect. self.assertEqual(sp("1960's"), "1960’s") self.assertEqual(sp("one two '60s"), "one two ‘60s") |