summaryrefslogtreecommitdiff
path: root/markdown/extensions/smarty.py
diff options
context:
space:
mode:
authorDmitry Shachnev <mitya57@gmail.com>2013-09-25 11:39:16 +0400
committerDmitry Shachnev <mitya57@gmail.com>2013-09-25 11:49:56 +0400
commit85e1a0c29c3f659fa1f36e94788a00b3e864b9d3 (patch)
tree2fd98a181ad9462b60911b2e3a37ef5688a33a10 /markdown/extensions/smarty.py
parente92d7cf65e394b378cd3f9a370fb8e0761e7f62c (diff)
downloadpython-markdown-85e1a0c29c3f659fa1f36e94788a00b3e864b9d3.tar.gz
Add new utility function parseBoolValue()
and use it in all extension that need parsing bool config values.
Diffstat (limited to 'markdown/extensions/smarty.py')
-rw-r--r--markdown/extensions/smarty.py11
1 files changed, 2 insertions, 9 deletions
diff --git a/markdown/extensions/smarty.py b/markdown/extensions/smarty.py
index 18f9217..a0737b7 100644
--- a/markdown/extensions/smarty.py
+++ b/markdown/extensions/smarty.py
@@ -68,6 +68,7 @@
from __future__ import unicode_literals
from . import Extension
from ..inlinepatterns import HtmlPattern
+from ..util import parseBoolValue
def canonicalize(regex):
"""
@@ -173,15 +174,7 @@ class SmartyExtension(Extension):
'smart_ellipses': [True, 'Educate ellipses']
}
for key, value in configs:
- if not isinstance(value, str):
- value = bool(value)
- elif value.lower() in ('true', 't', 'yes', 'y', '1'):
- value = True
- elif value.lower() in ('false', 'f', 'no', 'n', '0'):
- value = False
- else:
- raise ValueError('Cannot parse bool value: %s' % value)
- self.setConfig(key, value)
+ self.setConfig(key, parseBoolValue(value))
def _addPatterns(self, md, patterns, serie):
for ind, pattern in enumerate(patterns):