From e7b6a33f0e3dd37d276a0c18dcbdc62e2c80ed98 Mon Sep 17 00:00:00 2001 From: Martin Altmayer Date: Fri, 15 Aug 2014 15:47:35 +0200 Subject: Renamed 'smart_substitutions' option to 'substitutions'. Fixed a typo. --- docs/extensions/smarty.txt | 6 +++--- markdown/extensions/smarty.py | 5 ++--- tests/test_extensions.py | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/docs/extensions/smarty.txt b/docs/extensions/smarty.txt index 1c21d50..1f14fc7 100644 --- a/docs/extensions/smarty.txt +++ b/docs/extensions/smarty.txt @@ -22,7 +22,7 @@ ASCII symbol | Replacements | HTML Entities `--` | – | `–` `---` | — | `—` -Using the configuration option 'smart_substitutions' you can overwrite the +Using the configuration option 'substitutions' you can overwrite the default substitutions. Just pass a dict mapping (a subset of) the following keys to the substitution strings. @@ -34,7 +34,7 @@ keys to the substitution strings. Use e.g. the following config to get correct quotes for the German language: extensionConfigs = { - 'smarty': [('smart_substitutions', { + 'smarty': [('substitutions', { 'left-single-quote': '‚', # sb is not a typo! 'right-single-quote': '‘', 'left-double-quote': '„', @@ -71,7 +71,7 @@ Option | Default value | Description `smart_quotes` | enabled | whether to convert straight quotes `smart_angled_quotes` | disabled | whether to convert angled quotes `smart_ellipses` | enabled | whether to convert ellipses -`smart_substitutions` | {} | Overwrite default substitutions +`substitutions` | {} | overwrite default substitutions Further reading --------------- diff --git a/markdown/extensions/smarty.py b/markdown/extensions/smarty.py index ca9edd2..d5ac62c 100644 --- a/markdown/extensions/smarty.py +++ b/markdown/extensions/smarty.py @@ -151,12 +151,11 @@ class SmartyExtension(Extension): 'smart_angled_quotes': [False, 'Educate angled quotes'], 'smart_dashes': [True, 'Educate dashes'], 'smart_ellipses': [True, 'Educate ellipses'], - 'smart_substitutions' : [{}, 'Overwrite default substitutions'], + 'substitutions' : [{}, 'Overwrite default substitutions'], } super(SmartyExtension, self).__init__(*args, **kwargs) self.substitutions = dict(substitutions) - self.substitutions.update(self.getConfig('smart_substitutions', - default={})) + self.substitutions.update(self.getConfig('substitutions', default={})) def _addPatterns(self, md, patterns, serie): for ind, pattern in enumerate(patterns): diff --git a/tests/test_extensions.py b/tests/test_extensions.py index 9052b57..e30e877 100644 --- a/tests/test_extensions.py +++ b/tests/test_extensions.py @@ -590,7 +590,7 @@ class TestSmarty(unittest.TestCase): config = { 'smarty': [ ('smart_angled_quotes', True), - ('smart_substitutions', { + ('substitutions', { 'ndash': '\u2013', 'mdash': '\u2014', 'ellipsis': '\u2026', @@ -615,4 +615,4 @@ Must not be confused with 'ndash' (--) ... >> """

[ The „Unicode char of the year 2014“ is the ‚mdash‘: \u2014 Must not be confused with ‚ndash‘ (\u2013) \u2026 ]

""" - self.assertEqual(self.md.convert(text), correct) \ No newline at end of file + self.assertEqual(self.md.convert(text), correct) -- cgit v1.2.3