autolinking in wiki pages with manual links didn't work properly

This commit is contained in:
Graham Knop 2007-07-24 20:23:51 +00:00
parent 42b8fdf115
commit 2e953bd47b
2 changed files with 4 additions and 6 deletions

View file

@ -87,6 +87,7 @@
is now the Help Index.
- Allow editing previous revisions of assets in the current version tag
- Add user to transactions list and pending transactions.
- fix: autolinking in wiki pages with manual links didn't work properly
7.3.21
- fix: Self-deactivation doesn't show login screen after success

View file

@ -105,18 +105,15 @@ sub autolinkHtml {
$p->case_sensitive(1);
$p->marked_sections(1);
$p->unbroken_text(1);
$p->handler(start => sub { push @acc, $_[2]; if ($_[0] eq 'a' and exists $_[1]{href}) { $in_a++ } },
$p->handler(start => sub { push @acc, $_[2]; if ($_[0] eq 'a') { $in_a++ } },
'tagname, attr, text');
$p->handler(end => sub { push @acc, $_[2]; if ($_[0] eq 'a' and exists $_[1]{href}) { $in_a-- } },
$p->handler(end => sub { push @acc, $_[2]; if ($_[0] eq 'a') { $in_a-- } },
'tagname, attr, text');
$p->handler(text => sub {
my $text = $_[0];
unless ($in_a) {
$text =~ s{\&\#39\;}{\'}xms; # html entities for ' created by rich editor
while ($text =~ s#^(.*?)$regexp##i) {
push @acc, sprintf '%s<a href="%s">%s</a>',
($1, $mapping{lc $2}, $2);
}
$text =~ s{$regexp}{'<a href="' . $mapping{lc $1} . '">' . $1 . '</a>'}xmseg;
}
push @acc, $text;
}, 'text');