Wiki autolinks prefer longest title match

This commit is contained in:
Graham Knop 2007-07-30 17:40:29 +00:00
parent aaf7d9cf44
commit 265400a010
2 changed files with 2 additions and 2 deletions

View file

@ -98,7 +98,7 @@ sub autolinkHtml {
$key =~ s{\)}{\\\)}gxms; # escape parens
$mapping{$key} = $self->session->url->gateway($mapping{$key});
}
my $matchString = join('|', map{quotemeta} keys %mapping);
my $matchString = join('|', map{quotemeta} sort {length($b) <=> length($a)} keys %mapping);
my $regexp = qr/($matchString)/i;
my @acc = ();
my $in_a = 0;