Hallo Jakob,
Deswegen stelle ich diese Frage erneut: Wie
kann ich als Selfhtml-Links angebebene
Bestandteile eines Strings in html-code
umwandeln?
Hier wird das so gemacht:
# now transform all links...
my @links = ();
push @links,[$1, $2] while $txt =~ /[([Ll][Ii][Nn][Kk]):\s*([^]\s]+)\s*]/g;
@links = grep {
is_URL($_->[1] => qw(http ftp news nntp telnet gopher mailto))
or is_URL(($_->[1] =~ /[1][Ii][Ee][Ww]-[Ss][Oo][Uu][Rr][Cc][Ee]:(.+)/)[0] || '' => 'http')
or ($_->[1] =~ m<^(?:.?.?/(?!/)|?)> and is_URL(rel_uri($_ -> [1],$base) => 'http'))
} @links;
# replace links
$txt =~ s!$_!<a href="$1">$1</a>!g for map {
'[[Ll][Ii][Nn][Kk]:\s*('.quotemeta(plain($_->[1])).')]'
} @links;
Der Code ist eine leichte Abwandlung von André
Malos Original-Code.
Gruesse,
CK
Vv ↩︎