--- /Users/arthurclemens/Desktop/TWiki.pm.org Mon Jan 19 08:18:06 2004 +++ /Users/arthurclemens/Desktop/TWiki.pm Sat Feb 21 01:22:05 2004 @@ -2020,6 +2020,30 @@ } # ========================= +sub handleRelativeTopicPath +{ + my( $theStyleTopic, $theWeb ) = @_; + + if ( !$theStyleTopic ) { + return ""; + } + my $theRelativePath; + # if there is no dot in $theStyleTopic, no web has been specified + if ( index( $theStyleTopic, "." ) == -1 ) { + # add local web + $theRelativePath = $theWeb . "/" . $theStyleTopic; + } else { + $theRelativePath = $theStyleTopic; #including dot + } + # replace dot by slash is not necessary; TWiki.MyTopic is a valid url + # add ../ if not already present to make a relative file reference + if ( index( $theRelativePath, "../" ) == -1 ) { + $theRelativePath = "../" . $theRelativePath; + } + return $theRelativePath; +} + +# ========================= sub handleInternalTags { # modify arguments directly, i.e. call by reference @@ -2062,6 +2086,7 @@ $_[0] =~ s/%SCRIPTSUFFIX%/$scriptSuffix/g; $_[0] =~ s/%PUBURL%/$urlHost$pubUrlPath/g; $_[0] =~ s/%PUBURLPATH%/$pubUrlPath/g; + $_[0] =~ s/%RELATIVETOPICPATH{(.*?)}%/&handleRelativeTopicPath($1,$_[2])/ge; $_[0] =~ s/%ATTACHURL%/$urlHost$pubUrlPath\/$_[2]\/$_[1]/g; $_[0] =~ s/%ATTACHURLPATH%/$pubUrlPath\/$_[2]\/$_[1]/g; $_[0] =~ s/%ICON{(.*?)}%/&handleIcon($1)/geo; â