2 package IkiWiki::Plugin::htmlscrubber;
9 hook(type => "sanitize", id => "htmlscrubber", call => \&sanitize);
12 sub sanitize (@) { #{{{
14 return scrubber()->scrub($params{content});
19 return $_scrubber if defined $_scrubber;
21 eval q{use HTML::Scrubber};
23 # Lists based on http://feedparser.org/docs/html-sanitization.html
24 $_scrubber = HTML::Scrubber->new(
26 a abbr acronym address area b big blockquote br
27 button caption center cite code col colgroup dd del
28 dfn dir div dl dt em fieldset font form h1 h2 h3 h4
29 h5 h6 hr i img input ins kbd label legend li map
30 menu ol optgroup option p pre q s samp select small
31 span strike strong sub sup table tbody td textarea
32 tfoot th thead tr tt u ul var
34 default => [undef, { (
36 abbr accept accept-charset accesskey action
37 align alt axis border cellpadding cellspacing
38 char charoff charset checked cite class
39 clear cols colspan color compact coords
40 datetime dir disabled enctype for frame
41 headers height href hreflang hspace id ismap
42 label lang longdesc maxlength media method
43 multiple name nohref noshade nowrap prompt
44 readonly rel rev rows rowspan rules scope
45 selected shape size span src start summary
46 tabindex target title type usemap valign
49 "/" => 1, # emit proper <hr /> XHTML