Skip to content

Commit

Permalink
Item8556: Local Anchors don't use relative form
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@6772 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
KennethLavrsen authored and KennethLavrsen committed Mar 18, 2010
1 parent 6e4b9c6 commit a594807
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions core/lib/Foswiki/Render.pm
Original file line number Diff line number Diff line change
Expand Up @@ -672,9 +672,13 @@ sub _renderExistingWikiWord {
if ( ( $web eq $this->{session}->{webName} )
&& ( $topic eq $Foswiki::cfg{HomeTopicName} ) );

push(@cssClasses, 'foswikiCurrentTopicLink')
if ( ( $web eq $this->{session}->{webName} )
&& ( $topic eq $this->{session}->{topicName} ) );
my $inCurrentTopic = 0;

if ( ( $web eq $this->{session}->{webName} )
&& ( $topic eq $this->{session}->{topicName} ) ) {
push(@cssClasses, 'foswikiCurrentTopicLink');
$inCurrentTopic = 1;
}

my @attrs;
my $href = $this->{session}->getScriptUrl( 0, 'view', $web, $topic );
Expand All @@ -684,10 +688,12 @@ sub _renderExistingWikiWord {

if ($anchor) {
$anchor = $this->_makeAnchorName($anchor);

$anchor = Foswiki::urlEncode($anchor);

# No point in trying to make it unique; just aim at the first
# occurrence
$href = $href . '#' . Foswiki::urlEncode($anchor);
# Item8556 - drop path if same topic and anchor
$href = $inCurrentTopic ? "#$anchor" : "$href#$anchor";
}
push( @attrs, class => join(' ', @cssClasses) ) if ($#cssClasses >= 0);
push( @attrs, href => $href );
Expand Down

0 comments on commit a594807

Please sign in to comment.