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

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2004-03-11 - RussellOConnor
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.