]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/htmlscrubber.pm
fix error message to include url
[git.ikiwiki.info.git] / IkiWiki / Plugin / htmlscrubber.pm
index 41cf6c991c868bb95c3a1bc74dbfbad4e3cf4368..ae3ec44569d3e666ca5abe60f9afc19e5b6643c6 100644 (file)
@@ -6,12 +6,12 @@ use strict;
 use IkiWiki;
 
 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;
 } # }}}