[Jifty-commit] r7587 - jifty/trunk/lib/Jifty/Web/Form/Field

Jifty commits jifty-commit at lists.jifty.org
Wed Nov 4 00:59:40 EST 2009


Author: sartak
Date: Wed Nov  4 00:59:39 2009
New Revision: 7587

Modified:
   jifty/trunk/lib/Jifty/Web/Form/Field/Wikitext.pm

Log:
A step closer to proper Wikitext formatting

    Just need to deal with XSS

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 00:59:39 2009
@@ -17,11 +17,25 @@
 
 =cut
 
-sub canonicalize_value {
-    my $self = shift;
-    my $text = shift;
 
-    return Text::WikiFormat::format($text);
+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
+
+        $field .= Text::WikiFormat::format($text, {}, {
+            extended       => 1,
+            absolute_links => 1,
+            implicit_links => 0, # XXX: make this configurable
+            prefix         => Jifty->web->url,
+        });
+    }
+    $field .= qq!</span>\n!;
+    Jifty->web->out($field);
+    return '';
 }
 
 1;


More information about the Jifty-commit mailing list