Item11045: TOC doesn't remove manual links properly
Priority: Normal
Current State: Closed
Released In: 1.1.4
Target Release: patch
Applies To: Engine
Component:
Branches:
Test case:
%TOC%
<noautolink>
---++ headline <a href="#" class=" FooBar "> click me </a>
</noautolink>
Result is something like this:
Problem is that the TOC clean-up code generates <nop>s inside a <a href..../a> which then hinders the rest to be cleaned up properly.
Current patch:
--- lib/Foswiki/Macros/TOC.pm (revision 12289)
+++ lib/Foswiki/Macros/TOC.pm (working copy)
@@ -178,6 +178,9 @@
$text =~ s/(^|[\s\(])=+([^\s]+?|[^\s].*?[^\s])=+
($|[\s\,\.\;\:\!\?\)])/$1$2$3/gx;
+ # Prevent manual links
+ $text =~ s/<[\/]?a\b[^>]*>//gi;
+
# Prevent WikiLinks
$text =~ s/\[\[.*?\]\[(.*?)\]\]/$1/g; # '[[...][...]]'
$text =~ s/\[\[(.*?)\]\]/$1/ge; # '[[...]]'
@@ -190,9 +193,6 @@
$text =~ s/(^|[\s\-\*\(])
([$Foswiki::regex{mixedAlphaNum}]+\:)/$1<nop>$2/gox;
- # Prevent manual links
- $text =~ s/<[\/]?a\b[^>]*>//gi;
-
# Prevent duplicating id attributes
$text =~ s/id=["'][^"']*?["']//gi;
Needs a test case covering this as well as further checks that the other unit tests still pass ...
--
MichaelDaum - 16 Aug 2011
Item11137 has been marked a dupplicate of this report
--
MichaelDaum - 20 Sep 2011