aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2010-03-25 13:27:03 -0400
committerWaylan Limberg <waylan@gmail.com>2010-03-25 13:27:03 -0400
commit834f04b887c15017a2e08bb76f8a269d9ae074a2 (patch)
treec4cc569bdc428515935baa415909ba55f8d08db9
parentbd926140e0b4005fc082f12f7c119498ced420a2 (diff)
downloadmarkdown-834f04b887c15017a2e08bb76f8a269d9ae074a2.tar.gz
markdown-834f04b887c15017a2e08bb76f8a269d9ae074a2.tar.bz2
markdown-834f04b887c15017a2e08bb76f8a269d9ae074a2.zip
The html-tidy extension now fails gracefully when tidy is not installed on the system -- markdown continues without it.
-rw-r--r--markdown/extensions/html_tidy.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/markdown/extensions/html_tidy.py b/markdown/extensions/html_tidy.py
index 5105e33..e1736eb 100644
--- a/markdown/extensions/html_tidy.py
+++ b/markdown/extensions/html_tidy.py
@@ -29,7 +29,10 @@ Dependencies:
"""
import markdown
-import tidy
+try:
+ import tidy
+except ImportError:
+ tidy = None
class TidyExtension(markdown.Extension):
@@ -46,7 +49,8 @@ class TidyExtension(markdown.Extension):
# Save options to markdown instance
md.tidy_options = self.config
# Add TidyProcessor to postprocessors
- md.postprocessors['tidy'] = TidyProcessor(md)
+ if tidy:
+ md.postprocessors['tidy'] = TidyProcessor(md)
class TidyProcessor(markdown.postprocessors.Postprocessor):