[Cpan-forum-commit] rev 53 - in trunk: lib/CPAN lib/CPAN/Forum t
svn at pti.co.il
svn at pti.co.il
Tue Feb 1 23:30:47 IST 2005
Author: gabor
Date: 2005-02-01 23:30:47 +0200 (Tue, 01 Feb 2005)
New Revision: 53
Modified:
trunk/lib/CPAN/Forum.pm
trunk/lib/CPAN/Forum/Markup.pm
trunk/t/010-markup.t
Log:
improve the text suit. fix a bug that you could not post multi-line things from the web (while the tests passed)
because we are getting \r from the browser and not \n
Modified: trunk/lib/CPAN/Forum/Markup.pm
===================================================================
--- trunk/lib/CPAN/Forum/Markup.pm 2005-02-01 20:52:59 UTC (rev 52)
+++ trunk/lib/CPAN/Forum/Markup.pm 2005-02-01 21:30:47 UTC (rev 53)
@@ -21,12 +21,12 @@
close_b : m{</b>}
open_i : m{<i>}
close_i : m{</i>}
- text : m{[\t\n -;=?-~]+} {$item[1] }
+ text : m{[\r\t\n -;=?-~]+} {$item[1] }
marked_code: open_code code close_code { join("", @item[1..$#item]) }
open_code : m{<code>} { qq(<div class="code">) }
close_code : m{</code>} { qq(</div>) }
- code : m{[\t\n -~]+?(?=</code>)} { CGI::escapeHTML($item[1]) }
+ code : m{[\r\t\n -~]+?(?=</code>)} { CGI::escapeHTML($item[1]) }
eodata : m{^\Z}
};
Modified: trunk/lib/CPAN/Forum.pm
===================================================================
--- trunk/lib/CPAN/Forum.pm 2005-02-01 20:52:59 UTC (rev 52)
+++ trunk/lib/CPAN/Forum.pm 2005-02-01 21:30:47 UTC (rev 53)
@@ -1225,7 +1225,7 @@
$t->param(preview_loop => [\%preview]);
}
- $t->param(new_subject => _subject_escape($q->param("new_subject")));
+ #$t->param(new_subject => _subject_escape($q->param("new_subject")));
$t->param(group => $new_group) if $new_group;
return $t->output;
@@ -1276,6 +1276,9 @@
my $markup = CPAN::Forum::Markup->new();
my $result = $markup->posting_process($new_text) ;
if (not defined $result) {
+ $self->log->debug("--- BAD TEXT STARTS ---");
+ $self->log->debug($new_text);
+ $self->log->debug("--- BAD TEXT ENDS ---");
push @errors, "text_format";
return $self->posts(\@errors);
}
Modified: trunk/t/010-markup.t
===================================================================
--- trunk/t/010-markup.t 2005-02-01 20:52:59 UTC (rev 52)
+++ trunk/t/010-markup.t 2005-02-01 21:30:47 UTC (rev 53)
@@ -70,7 +70,21 @@
}
-my $code = q(
+my $data = join "", <DATA>;
+foreach my $code (split /CODE/, $data) {
+ print STDERR $code;
+ my $out = $markup->posting_process($code);
+ ok(defined($out), "BIG CODE");
+ ok(length($out) > length ($code));
+}
+
+
+sub f {
+ $markup->posting_process(@_);
+}
+
+__DATA__
+<code>
#!/usr/bin/perl
open my $fh, ">>", "filename";
@@ -79,19 +93,16 @@
xxl
}
-);
-$code = "<code>$code</code>";
+</code>
+CODE
+some
+<code>
+#!/usr/bin/perl
-my $out = $markup->posting_process($code);
-ok(defined($out), "BIG CODE");
-ok(length($out) > length ($code));
-
-
-
-
-
-sub f {
- $markup->posting_process(@_);
+while (<qqrq>) {
+ more todo
}
+1;
+</code>
More information about the Cpan-forum-commit
mailing list