From 834f04b887c15017a2e08bb76f8a269d9ae074a2 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Thu, 25 Mar 2010 13:27:03 -0400 Subject: The html-tidy extension now fails gracefully when tidy is not installed on the system -- markdown continues without it. --- markdown/extensions/html_tidy.py | 8 ++++++-- 1 file 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): -- cgit v1.2.3