From 4895955ceaf264c5f17b10c4009e1ab1afcc55ee Mon Sep 17 00:00:00 2001 From: joey Date: Mon, 28 Aug 2006 18:17:59 +0000 Subject: * Change htmlize, format, and sanitize hooks to use named parameters. --- IkiWiki/Plugin/htmltidy.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to '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; -- cgit v1.2.3