X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/480a49af4755ae42d409ed351f99219cee846638..fe5c48f3a002df1867d045b3767900f83817038a:/IkiWiki/Plugin/htmltidy.pm diff --git a/IkiWiki/Plugin/htmltidy.pm b/IkiWiki/Plugin/htmltidy.pm index eb8f9d3d3..079da7b49 100644 --- a/IkiWiki/Plugin/htmltidy.pm +++ b/IkiWiki/Plugin/htmltidy.pm @@ -16,7 +16,9 @@ sub import { #{{{ IkiWiki::hook(type => "sanitize", id => "tidy", call => \&sanitize); } # }}} -sub sanitize ($) { #{{{ +sub sanitize (@) { #{{{ + my %params=@_; + my $tries=10; while (1) { eval { @@ -26,14 +28,14 @@ sub sanitize ($) { #{{{ $tries--; if ($tries < 1) { IkiWiki::debug("failed to run tidy: $@"); - return shift; + return $params{content}; } } # open2 doesn't respect "use open ':utf8'" binmode (IN, ':utf8'); binmode (OUT, ':utf8'); - print OUT shift; + print OUT $params{content}; close OUT; local $/ = undef;