my $params = shift;
$posting =~ s/\015\012|\015|\012/\n/g; # normalize newlines
- $posting =~ s/[^\S\n]$//gm; # kill whitespaces at the end of all lines
+ $posting =~ s/[^\S\n]+$//gm; # kill whitespaces at the end of all lines
$posting =~ s/\s+$//; # kill whitespaces (newlines) at the end of the string (text)
# check the special syntaxes:
my @links = grep {
is_URL ( $_ -> [1] => ':ALL')
or is_URL (($_ -> [1] =~ /^[Vv][Ii][Ee][Ww]-[Ss][Oo][Uu][Rr][Cc][Ee]:(.+)/)[0] || '' => 'http')
- or ( $_ -> [1] =~ m<^\.?\.?/(?!/)|\?>
+ or ( $_ -> [1] =~ m<^(?:\.?\.?/(?!/)|\?)>
and is_URL (rel_uri ($_ -> [1], $base) => 'http'))
} @rawlinks;
push @rawimages => [$1 => $2] while ($posting =~ /\[([Ii][Mm][Aa][Gg][Ee]):\s*([^\]\s]+)\s*\]/g);
my @images = grep {
is_URL ($_ -> [1] => 'strict_http')
- or ( $_ -> [1] =~ m<^\.?\.?/(?!/)|\?>
+ or ( $_ -> [1] =~ m<^(?:\.?\.?/(?!/)|\?)>
and is_URL (rel_uri ($_ -> [1], $base) => 'http'))
} @rawimages;
push @rawiframes => [$1 => $2] while ($posting =~ /\[([Ii][Ff][Rr][Aa][Mm][Ee]):\s*([^\]\s]+)\s*\]/g);
my @iframes = grep {
is_URL ($_ -> [1] => 'http')
- or is_URL (($_ -> [1] =~ /^[Vv][Ii][Ee][Ww]-[Ss][Oo][Uu][Rr][Cc][Ee]:(.+)/)[0] || '' => 'http')
- or ( $_ -> [1] =~ m<^\.?\.?/(?!/)|\?>
+ or ( $_ -> [1] =~ m<^(?:\.?\.?/(?!/)|\?)>
and is_URL (rel_uri ($_ -> [1], $base) => 'http'))
} @rawiframes;
my $area = $$posting;
my $qchar = $params -> {quoteChars};
- $area =~ s/<br>/\n/g; # <br> => \n
- $area =~ s/&(?:#160|nbsp);/ /g; # nbsp => ' '
+ $area =~ s/<br(?:\/| \/)?>/\n/g; # <br> => \n
+ $area =~ s/&(?:#160|nbsp);/ /g; # nbsp => ' '
$area =~ s/^(.)/\177$1/gm if ($params -> {quoteArea}); # shift a quoting character
$area =~ s/^(\177+)/$qchar x length ($1)/gem; # decode normalized quoting characters
my $posting = ${+shift};
my $params = shift || {};
+ my $break = '<br />';
if ($params -> {quoting}) { # quotes are displayed as special?
my @array = [0 => []];
- for (split /<br>/ => $posting) {
+ for (split /<br(?:\/| \/)?>/ => $posting) {
my $l = length ((/^(\177*)/)[0]);
if ($array[-1][0] == $l) {
push @{$array[-1][-1]} => $_;
}
shift @array unless @{$array[0][-1]};
- $posting = join '<br>' => map {
- $_->[0]
- ? join join ('<br>' => @{$_->[-1]}) => ($params->{startCite}, $params->{endCite})
- : (join '<br>' => @{$_->[-1]});
+ my $ll=0;
+ $posting = join $break => map {
+ my $string = $_->[0]
+ ? (($ll and $ll != $_->[0]) ? $break : '') .
+ join join ($break => @{$_->[-1]})
+ => ($params->{startCite}, $params->{endCite})
+ : (join $break => @{$_->[-1]});
+ $ll = $_->[0]; $string;
} @array;
}
#
#
-### end of Encode::Posting #####################################################
\ No newline at end of file
+### end of Encode::Posting #####################################################