X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/408ee89fd7c1dc70510385a7cf263a05862dda97..7aa10a2952a0d0ee8543f575966f7e4a780c993c:/IkiWiki/Plugin/htmltidy.pm diff --git a/IkiWiki/Plugin/htmltidy.pm b/IkiWiki/Plugin/htmltidy.pm index 8a0e8f428..da77e60f1 100644 --- a/IkiWiki/Plugin/htmltidy.pm +++ b/IkiWiki/Plugin/htmltidy.pm @@ -15,6 +15,7 @@ use IPC::Open2; sub import { hook(type => "getsetup", id => "tidy", call => \&getsetup); hook(type => "sanitize", id => "tidy", call => \&sanitize); + hook(type => "checkconfig", id => "tidy", call => \&checkconfig); } sub getsetup () { @@ -25,16 +26,23 @@ sub getsetup () { }, htmltidy => { type => "string", - example => "tidy --show-body-only yes --show-warnings no --tidy-mark no --markup yes -quiet -asxhtml -utf8", description => "tidy command line", safe => 0, # path - rebuild => 0, + rebuild => undef, }, } +sub checkconfig () { + if (! defined $config{htmltidy}) { + $config{htmltidy}="tidy -quiet -asxhtml -utf8 --show-body-only yes --show-warnings no --tidy-mark no --markup yes"; + } +} + sub sanitize (@) { my %params=@_; + return $params{content} unless defined $config{htmltidy}; + my $pid; my $sigpipe=0; $SIG{PIPE}=sub { $sigpipe=1 };