X-Git-Url: https://git.p6c8.net/selfforum.git/blobdiff_plain/489e7846289d4fb66eb4b9fab0fed4af719b98ee..dd4ab9aedf7e7eaebddaf5c00f506972dad42b4c:/selfforum-cgi/shared/Encode/Posting.pm?ds=sidebyside diff --git a/selfforum-cgi/shared/Encode/Posting.pm b/selfforum-cgi/shared/Encode/Posting.pm index c0815f4..ffafbf1 100644 --- a/selfforum-cgi/shared/Encode/Posting.pm +++ b/selfforum-cgi/shared/Encode/Posting.pm @@ -60,7 +60,7 @@ sub encoded_body ($;$) { 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: @@ -73,7 +73,7 @@ sub encoded_body ($;$) { 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; @@ -83,7 +83,7 @@ sub encoded_body ($;$) { 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; @@ -93,8 +93,7 @@ sub encoded_body ($;$) { 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; @@ -209,6 +208,7 @@ sub message_field ($$) { my $posting = ${+shift}; my $params = shift || {}; + my $break = '
'; if ($params -> {quoting}) { # quotes are displayed as special? my @array = [0 => []]; @@ -224,10 +224,14 @@ sub message_field ($$) { } shift @array unless @{$array[0][-1]}; + my $ll=0; $posting = join '
' => map { - $_->[0] - ? join join ('
' => @{$_->[-1]}) => ($params->{startCite}, $params->{endCite}) - : (join '
' => @{$_->[-1]}); + my $string = $_->[0] + ? (($ll and $ll != $_->[0]) ? $break : '') . + join join ($break => @{$_->[-1]}) + => ($params->{startCite}, $params->{endCite}) + : (join $break => @{$_->[-1]}); + $ll = $_->[0]; $string; } @array; }