Tags:
create new tag
, view all tags

Bug: TOC incorrectly strips out links in headers

When there are mulitple links in a heading, the TOC generations incorrectly strips out the the links.

The problem is that the perl script does matching like

/\[\[.*\]\[(.*)?\]\]/$1/g

instead it should be:

/\[\[[^\]]*\]\[([^\]]*)?\]\]/$1/g

It was a very easy fix to make on our machine.

Test case

Some Heading

Environment

TWiki version: TWikiRelease01Feb2003
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Linux
Web server: Apache
Perl version:  
Client OS: Windows XP
Web Browser: Mozilla

-- RussellOConnor - 26 Feb 2004

Follow up

Fix record

Thanks Russell for posting this. I fixed it by changing a greedy .* match to a non-greedy .*? one. Fix is in TWikiAlphaRelease and at TWiki.org.

Change:

RCS file: /cvsroot/twiki/twiki/lib/TWiki.pm,v
retrieving revision 1.292
diff -r1.292 TWiki.pm
2362,2363c2362,2363
<                 $line =~ s/\[\[.*\]\[(.*?)\]\]/$1/g;  # '[[...][...]]'
>                 $line =~ s/\[\[(.*?)\]\]/$1/ge;       # '[[...]]'
---
>                 $line =~ s/\[\[.*?\]\[(.*?)\]\]/$1/g;  # '[[...][...]]'
>                 $line =~ s/\[\[(.*?)\]\]/$1/ge;        # '[[...]]'

-- PeterThoeny - 29 Feb 2004

Topic revision: r3 - 2004-03-11 - RussellOConnor
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.