# Feel free to use it from other plugins.
our $safe_url_regexp;
-sub import { #{{{
+sub import {
hook(type => "getsetup", id => "htmlscrubber", call => \&getsetup);
hook(type => "sanitize", id => "htmlscrubber", call => \&sanitize);
# data is a special case. Allow data:image/*, but
# disallow data:text/javascript and everything else.
$safe_url_regexp=qr/^(?:(?:$uri_schemes):|data:image\/|[^:]+(?:$|\/))/i;
-} # }}}
+}
-sub getsetup () { #{{{
+sub getsetup () {
return
plugin => {
safe => 1,
safe => 1,
rebuild => undef,
},
-} #}}}
+}
-sub sanitize (@) { #{{{
+sub sanitize (@) {
my %params=@_;
if (exists $config{htmlscrubber_skip} &&
}
return scrubber()->scrub($params{content});
-} # }}}
+}
my $_scrubber;
-sub scrubber { #{{{
+sub scrubber {
return $_scrubber if defined $_scrubber;
eval q{use HTML::Scrubber};
}],
);
return $_scrubber;
-} # }}}
+}
1