diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 9a8745453..22b7825ae 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -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 diff --git a/lib/WebGUI/Asset/Wobject/WikiMaster.pm b/lib/WebGUI/Asset/Wobject/WikiMaster.pm index 89bdb3d44..b5a1aeb04 100644 --- a/lib/WebGUI/Asset/Wobject/WikiMaster.pm +++ b/lib/WebGUI/Asset/Wobject/WikiMaster.pm @@ -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%s', - ($1, $mapping{lc $2}, $2); - } + $text =~ s{$regexp}{'' . $1 . ''}xmseg; } push @acc, $text; }, 'text');