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