NOTE: If you are a developer, please use a private wiki based on foswiki/trunk on a daily base ...or use trunk.foswiki.org to view this page for some minimal testing.
Use Item9693 for docu changes for 1.2 and 2.0.

Item11045: TOC doesn't remove manual links properly

Priority: CurrentState: AppliesTo: Component: WaitingFor:
Normal Closed Engine    
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
 

ItemTemplate edit

Summary TOC doesn't remove manual links properly
ReportedBy MichaelDaum
Codebase 1.1.3, trunk
SVN Range
AppliesTo Engine
Component
Priority Normal
CurrentState Closed
WaitingFor
Checkins Foswikirev:12676 Foswikirev:12677
TargetRelease patch
ReleasedIn 1.1.4
Topic revision: r6 - 17 Dec 2011, GeorgeClark
 
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons LicenseGet Foswiki at sourceforge.net. Fast, secure and Free Open Source software downloads