diff options
author | Waylan Limberg <waylan@gmail.com> | 2010-03-25 13:27:03 -0400 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2010-03-25 13:27:03 -0400 |
commit | 834f04b887c15017a2e08bb76f8a269d9ae074a2 (patch) | |
tree | c4cc569bdc428515935baa415909ba55f8d08db9 | |
parent | bd926140e0b4005fc082f12f7c119498ced420a2 (diff) | |
download | markdown-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.py | 8 |
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): |