]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/htmltidy.pm
* Support inlining pages raw, rather than creating a blog.
[ikiwiki.git] / IkiWiki / Plugin / htmltidy.pm
index e3929731991ab1e9c37fd1f7d4910d42ee820e4d..eb8f9d3d37efb4037d53ee7a23bcae168a5b8826 100644 (file)
@@ -17,7 +17,18 @@ sub import { #{{{
 } # }}}
 
 sub sanitize ($) { #{{{
-       open2(*IN, *OUT, 'tidy -quiet -asxhtml -utf8 --show-body-only yes --show-warnings no --tidy-mark no') or return shift;
+       my $tries=10;
+       while (1) {
+               eval {
+                       open2(*IN, *OUT, 'tidy -quiet -asxhtml -utf8 --show-body-only yes --show-warnings no --tidy-mark no');
+               };
+               last unless $@;
+               $tries--;
+               if ($tries < 1) {
+                       IkiWiki::debug("failed to run tidy: $@");
+                       return shift;
+               }
+       }
        # open2 doesn't respect "use open ':utf8'"
        binmode (IN, ':utf8'); 
        binmode (OUT, ':utf8');