]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/htmlscrubber.pm
* Apply a patch from Carl Worth allowing a class attribute to be passed
[git.ikiwiki.info.git] / IkiWiki / Plugin / htmlscrubber.pm
index 41cf6c991c868bb95c3a1bc74dbfbad4e3cf4368..c5b08f60435b8b37ffb0b75732cfe92a8a6980ad 100644 (file)
@@ -3,15 +3,15 @@ package IkiWiki::Plugin::htmlscrubber;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
-       IkiWiki::hook(type => "sanitize", id => "htmlscrubber",
-               call => \&sanitize);
+       hook(type => "sanitize", id => "htmlscrubber", call => \&sanitize);
 } # }}}
 
-sub sanitize ($) { #{{{
-       return scrubber()->scrub(shift);
+sub sanitize (@) { #{{{
+       my %params=@_;
+       return scrubber()->scrub($params{content});
 } # }}}
 
 my $_scrubber;
@@ -19,6 +19,7 @@ sub scrubber { #{{{
        return $_scrubber if defined $_scrubber;
        
        eval q{use HTML::Scrubber};
+       error($@) if $@;
        # Lists based on http://feedparser.org/docs/html-sanitization.html
        $_scrubber = HTML::Scrubber->new(
                allow => [qw{
@@ -43,7 +44,8 @@ sub scrubber { #{{{
                        selected shape size span src start summary
                        tabindex target title type usemap valign
                        value vspace width
-               }}],
+               }, "/" => 1, # emit proper <hr /> XHTML
+               }],
        );
        return $_scrubber;
 } # }}}