[Jifty-commit] r7588 - in jifty/trunk: lib/Jifty/Web/Form/Field

Jifty commits jifty-commit at lists.jifty.org
Wed Nov 4 01:38:32 EST 2009


Author: sartak
Date: Wed Nov  4 01:38:32 2009
New Revision: 7588

Modified:
   jifty/trunk/META.yml
   jifty/trunk/Makefile.PL
   jifty/trunk/lib/Jifty/Web/Form/Field/Wikitext.pm

Log:
Scrub text of HTML before WikiFormat gets to it

Modified: jifty/trunk/META.yml
==============================================================================
--- jifty/trunk/META.yml	(original)
+++ jifty/trunk/META.yml	Wed Nov  4 01:38:32 2009
@@ -85,6 +85,7 @@
   HTML::Lint: 0
   HTML::Mason: 1.3101
   HTML::Mason::Plugin: 0
+  HTML::Scrubber: 0
   HTTP::Cookies: 0
   HTTP::Date: 0
   HTTP::Server::Simple: 0.35

Modified: jifty/trunk/Makefile.PL
==============================================================================
--- jifty/trunk/Makefile.PL	(original)
+++ jifty/trunk/Makefile.PL	Wed Nov  4 01:38:32 2009
@@ -45,6 +45,7 @@
 requires('HTML::Lint');
 requires('HTML::Mason' => 1.3101);           # HTML::Mason::Exceptions HTML::Mason::FakeApache HTML::Mason::MethodMaker HTML::Mason::Request HTML::Mason::Utils
 requires('HTML::Mason::Plugin');
+requires('HTML::Scrubber');
 requires('HTTP::Cookies');
 requires('HTTP::Date');
 requires('HTTP::Server::Simple' => '0.35');  # HTTP::Server::Simple::CGI

Modified: jifty/trunk/lib/Jifty/Web/Form/Field/Wikitext.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Field/Wikitext.pm	(original)
+++ jifty/trunk/lib/Jifty/Web/Form/Field/Wikitext.pm	Wed Nov  4 01:38:32 2009
@@ -4,6 +4,7 @@
 use base qw/Jifty::Web::Form::Field::Textarea/;
 
 use Text::WikiFormat;
+use HTML::Scrubber;
 
 __PACKAGE__->mk_accessors(qw(rows cols));
 
@@ -11,22 +12,22 @@
 
 Jifty::Web::Form::Field::Wikitext - A textarea that renders wiki syntax
 
-=head2 canonicalize_value
+=head2 render_value
 
 Renders the value using L<Text::WikiFormat>.
 
 =cut
 
-
 sub render_value {
     my $self  = shift;
     my $field = '<span';
     $field .= qq! class="@{[ $self->classes ]} value"> !;
     if (defined $self->current_value) {
         my $text = "@{[$self->current_value]}";
-        # XXX: scrub html out of $text
+        my $scrubber = HTML::Scrubber->new;
+        my $scrubbed = $scrubber->scrub($text);
 
-        $field .= Text::WikiFormat::format($text, {}, {
+        $field .= Text::WikiFormat::format($scrubbed, {}, {
             extended       => 1,
             absolute_links => 1,
             implicit_links => 0, # XXX: make this configurable


More information about the Jifty-commit mailing list