Bug: TOC on topic other then the current one is broken
If you show a table of content for another topic you get relative links to the current topic instead of links to the other topic. That is, the links do not work.
This bug was introduced recently with the
TOCLinkURIRefsNotRelative fix.
Test case
- Create a topic with some headings, name it TestTocA
- Write a TOC in another topic, TestTocB, referencing that topic, e.g.
%TOC{TestTocA}%
- It points to headings in TestTocB instead of TestTocA
Environment
--
PeterThoeny - 18 Jul 2004
Follow up
Fix record
Fix is in
SVN. Not marked as Cairo fix since introduced recently.
Index: TWiki.pm
===================================================================
--- TWiki.pm (revision 1575)
+++ TWiki.pm (working copy)
@@ -154,7 +154,7 @@
# ===========================
# TWiki version:
-$wikiversion = 'Alpha 15 Jul 2004 $Rev$';
+$wikiversion = 'Alpha 17 Jul 2004 $Rev$';
# ===========================
# Key Global variables, required for writeDebug
@@ -2422,6 +2422,11 @@
$level =~ s/$regex{headerPatternHt}/$1/gio;
$line =~ s/$regex{headerPatternHt}/$2/gio;
}
+ my $urlPath = "";
+ if( "$web.$topicname" ne "$webName.$topicName" ) {
+ # not current topic, can't omit URL
+ $urlPath = "$dispScriptUrlPath$dispViewPath$scriptSuffix/$webPath/$topicname";
+ }
if( ( $line ) && ( $level <= $depth ) ) {
$anchor = TWiki::Render::makeAnchorName( $line );
# cut TOC exclude '---+ heading !! exclude'
@@ -2444,7 +2449,7 @@
$line =~ s/([\s\(])($regex{wikiWordRegex})/$1<nop>$2/g; # 'TopicName'
$line =~ s/([\s\(])($regex{abbrevRegex})/$1<nop>$2/g; # 'TLA'
# create linked bullet item, using a relative link to anchor
- $line = "$tabs* <a href=\"#$anchor\">$line</a>";
+ $line = "$tabs* <a href=\"$urlPath#$anchor\">$line</a>";
$result .= "\n$line";
}
}
--
PeterThoeny - 18 Jul 2004