foreach my $char (split //, '\\`*_{}[]()>#+-.!~') {
$g_escape_table{$char} = md5_hex($char);
}
+$g_escape_table{'<'} = md5_hex('<');
sub new {
my $invocant = shift;
sub _DoAutoLinks {
my ($self, $text) = @_;
- $text =~ s{(?:<|<)((?:https?|ftp):[^'">\s]+)(?:>|>)}{<a href="$1">$1</a>}gi;
+ $text =~ s{(?:<|<)((?:https?|ftp):[^'">\s]+?)(?:>|>)}{<a href="$1">$1</a>}gi;
return $text;
}
# In other words, html_quote() will change '>' to '&gt;' and then we will
# change '&gt' -> '>' -> '>' if we write this substitution as the first one.
$text =~ s/&/&/g;
+ $text =~ s{<a \s+ href="(?:mailto:)? (.+?)"> \1 </a>}{$1}xmgi;
$text = $self->SUPER::_EncodeCode($text);
$text =~ s/~/$g_escape_table{'~'}/go;
+ # Encode '<' to prevent URLs from getting linkified in code spans
+ $text =~ s/</$g_escape_table{'<'}/go;
return $text;
}
$text = $self->SUPER::_UnescapeSpecialChars($text);
$text =~ s/$g_escape_table{'~'}/~/go;
+ $text =~ s/$g_escape_table{'<'}/</go;
return $text;
}