]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/htmltidy.pm
Don't memoize ensure_committer
[git.ikiwiki.info.git] / IkiWiki / Plugin / htmltidy.pm
index 8a0e8f42874cd4cc0eddc70f0f48830185a8b4c4..da77e60f1cb6198278e87897522fd74b553f95e9 100644 (file)
@@ -15,6 +15,7 @@ use IPC::Open2;
 sub import {
        hook(type => "getsetup", id => "tidy", call => \&getsetup);
        hook(type => "sanitize", id => "tidy", call => \&sanitize);
 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 () {
 }
 
 sub getsetup () {
@@ -25,16 +26,23 @@ sub getsetup () {
                },
                htmltidy => {
                        type => "string",
                },
                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
                        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=@_;
 
 sub sanitize (@) {
        my %params=@_;
 
+       return $params{content} unless defined $config{htmltidy};
+
        my $pid;
        my $sigpipe=0;
        $SIG{PIPE}=sub { $sigpipe=1 };
        my $pid;
        my $sigpipe=0;
        $SIG{PIPE}=sub { $sigpipe=1 };