aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_extensions.py
diff options
context:
space:
mode:
authorMartin Altmayer <altmayer@posteo.de>2014-08-14 23:08:51 +0200
committerMartin Altmayer <altmayer@posteo.de>2014-08-14 23:08:51 +0200
commite90687e8520630e97cd47c725a6438ca1ca83c91 (patch)
treeea9c8acb06402fd02036123138056b8af129f65a /tests/test_extensions.py
parent927ad008b51e5fa265b6e8497805ff09ec098d65 (diff)
downloadmarkdown-e90687e8520630e97cd47c725a6438ca1ca83c91.tar.gz
markdown-e90687e8520630e97cd47c725a6438ca1ca83c91.tar.bz2
markdown-e90687e8520630e97cd47c725a6438ca1ca83c91.zip
Added test for the new 'smart_substitutions' feature of Smarty extension.
Diffstat (limited to 'tests/test_extensions.py')
-rw-r--r--tests/test_extensions.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/test_extensions.py b/tests/test_extensions.py
index a689cd2..9052b57 100644
--- a/tests/test_extensions.py
+++ b/tests/test_extensions.py
@@ -583,3 +583,36 @@ class TestTOC(unittest.TestCase):
'</li>\n'
'</ul>\n'
'</div>\n')
+
+
+class TestSmarty(unittest.TestCase):
+ def setUp(self):
+ config = {
+ 'smarty': [
+ ('smart_angled_quotes', True),
+ ('smart_substitutions', {
+ 'ndash': '\u2013',
+ 'mdash': '\u2014',
+ 'ellipsis': '\u2026',
+ 'left-single-quote': '&sbquo;', # sb is not a typo!
+ 'right-single-quote': '&lsquo;',
+ 'left-double-quote': '&bdquo;',
+ 'right-double-quote': '&ldquo;',
+ 'left-angle-quote': '[',
+ 'right-angle-quote': ']',
+ }),]
+ }
+ self.md = markdown.Markdown(extensions=['smarty'],
+ extension_configs=config)
+
+ def testCustomSubstitutions(self):
+ text = \
+"""<< The "Unicode char of the year 2014"
+is the 'mdash': ---
+Must not be confused with 'ndash' (--) ... >>
+"""
+ correct = \
+"""<p>[ The &bdquo;Unicode char of the year 2014&ldquo;
+is the &sbquo;mdash&lsquo;: \u2014
+Must not be confused with &sbquo;ndash&lsquo; (\u2013) \u2026 ]</p>"""
+ self.assertEqual(self.md.convert(text), correct) \ No newline at end of file