htmlscrubber: Add a config setting that can be used to disable the scrubber acting...
authorJoey Hess <joey@kodama.kitenet.net>
Fri, 26 Sep 2008 22:05:36 +0000 (18:05 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Fri, 26 Sep 2008 22:07:37 +0000 (18:07 -0400)
IkiWiki/Plugin/htmlscrubber.pm
debian/changelog
doc/plugins/htmlscrubber.mdwn

index 923907b047b8657e03857c91a500df5eb18911c5..7398c84784632048c41eab1976436578a8bf7027 100644 (file)
@@ -41,10 +41,26 @@ sub getsetup () { #{{{
                        safe => 1,
                        rebuild => undef,
                },
+               htmlscrubber_skip => {
+                       type => "pagespec",
+                       example => "!*/Discussion",
+                       description => "PageSpec specifying pages not to scrub",
+                       link => "ikiwiki/PageSpec",
+                       safe => 1,
+                       rebuild => undef,
+               },
 } #}}}
 
 sub sanitize (@) { #{{{
        my %params=@_;
+
+       if (exists $config{htmlscrubber_skip} &&
+           length $config{htmlscrubber_skip} &&
+           exists $params{destpage} &&
+           pagespec_match($params{destpage}, $config{htmlscrubber_skip})) {
+               return $params{content};
+       }
+
        return scrubber()->scrub($params{content});
 } # }}}
 
index 20aef4037c71c67bf618d0785209f7ac14cd378c..6ab7b1d704a9825b9a54d493169238a275c7a43e 100644 (file)
@@ -8,6 +8,8 @@ ikiwiki (2.66) UNRELEASED; urgency=low
   * git: Fix handling of utf-8 filenames in recentchanges.
   * tag: Make edit link for new tags ensure that the tags are created
     inside tagbase, when it's set.
+  * htmlscrubber: Add a config setting that can be used to disable the
+    scrubber acting on a set of pages.
 
  -- Joey Hess <joeyh@debian.org>  Thu, 25 Sep 2008 13:45:55 -0400
 
index b651ffc99bb70a2d129c5158682c307034fac6c2..7db372e1be272b185dc735f8fb27a79ed612420c 100644 (file)
@@ -31,6 +31,12 @@ Note that enabling or disabling the htmlscrubber plugin also affects some
 other HTML-related functionality, such as whether [[meta]] allows
 potentially unsafe HTML tags.
 
+The `htmlscrubber_skip` configuration setting can be used to skip scrubbing
+of some pages. Set it to a [[PageSpec]], such as "!*/Discussion", and pages
+matching that can have all the evil CSS, JavsScript, and unsafe html
+elements you like. One safe way to use this is to use [[lockedit]] to lock
+those pages, so only admins can edit them.
+
 ----
 
 Some examples of embedded javascript that won't be let through when this