Initial uri parsing support
This commit is contained in:
parent
1abb52c99a
commit
81a6c52032
36
II/T.pm
36
II/T.pm
@ -167,13 +167,40 @@ sub pre {
|
|||||||
$post =~ s/>(.+)/<font color='green'>>$1<\/font>/g;
|
$post =~ s/>(.+)/<font color='green'>>$1<\/font>/g;
|
||||||
$post =~ s/--/—/g;
|
$post =~ s/--/—/g;
|
||||||
$post =~ s/.?\*(.+)\*.?/ <b>$1<\/b> /g;
|
$post =~ s/.?\*(.+)\*.?/ <b>$1<\/b> /g;
|
||||||
|
|
||||||
|
# URI's parsing
|
||||||
|
if ( $post =~ m!^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?! ) {
|
||||||
|
|
||||||
|
print "\n2:=$2=\n";
|
||||||
|
# Images
|
||||||
|
if ( $9 !=~ m/.+\.(jpg|png|gif)/ ) {
|
||||||
|
$post
|
||||||
|
=~ s/(https?:\/\/.+)/<a href="$1">$1<\/a>/g;
|
||||||
|
}
|
||||||
|
elsif ( $9 =~ m/.+\.((jpg|png|gif)|(JPG|PNG|GIF))/ ) {
|
||||||
|
$post
|
||||||
|
=~ s/(https?:\/\/.+\.(jpg|png|gif))/<a href="$1"><img src="$1" width="15%" height="15%" \/><\/a>/g;
|
||||||
|
$post
|
||||||
|
=~ s/(https?:\/\/.+\.(JPG|PNG|GIF))/<a href="$1"><img src="$1" width="15%" height="15%" \/><\/a>/g;
|
||||||
|
}
|
||||||
|
elsif ( $2 eq 'ii' ) {
|
||||||
|
# ii uri
|
||||||
|
$post =~ s/ii:\/\/(.+\.\d{1,4}),?.+/<a href="\/e?echo=$1&view=thread">$1<\/a>/g;
|
||||||
|
$post =~ s/ii:\/\/(.{20})/<a href="\/send?hash=$1">$1<\/a>/g;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$post =~ s/^$/<br>\n/g;
|
$post =~ s/^$/<br>\n/g;
|
||||||
$post =~ s/(.?)\n/$1<br>\n/g;
|
$post =~ s/(.?)\n/$1<br>\n/g;
|
||||||
$post =~ s/\*(.+)/<li>$1<\/li>\n/g;
|
$post =~ s/\*(.+)/<li>$1<\/li>\n/g;
|
||||||
$post
|
|
||||||
=~ s/(https?:\/\/.+\.(jpg|png|gif))/<a href="$1"><img src="$1" width="15%" height="15%" \/><\/a>/g;
|
|
||||||
$post
|
# Url
|
||||||
=~ s/(https?:\/\/.+\.(JPG|PNG|GIF))/<a href="$1"><img src="$1" width="15%" height="15%" \/><\/a>/g;
|
# use Regexp::Common "URI";
|
||||||
|
# $post =~ s( ($RE{URI}{HTTP}) )
|
||||||
|
# (<a href="$1">$1</a>)gx;
|
||||||
|
|
||||||
|
|
||||||
# Not are regexp parsing
|
# Not are regexp parsing
|
||||||
my $pre = 0;
|
my $pre = 0;
|
||||||
my $txt;
|
my $txt;
|
||||||
@ -192,6 +219,7 @@ sub pre {
|
|||||||
$txt .= $line;
|
$txt .= $line;
|
||||||
}
|
}
|
||||||
close $fh;
|
close $fh;
|
||||||
|
|
||||||
return $txt;
|
return $txt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user