Skip to content

Commit

Permalink
Item9009: TOC macro called normalizeWebTopicName with web and topic n…
Browse files Browse the repository at this point in the history
…ames reversed

git-svn-id: http://svn.foswiki.org/trunk@7386 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
GeorgeClark authored and GeorgeClark committed May 13, 2010
1 parent 2b6272a commit 0d4586b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
30 changes: 12 additions & 18 deletions UnitTestContrib/test/unit/TOCTests.pm
Expand Up @@ -170,29 +170,23 @@ HERE
my $topicObject = Foswiki::Meta->new(
$this->{session}, $this->{test_web}, $this->{test_topic}, $text );
$topicObject->save();
$text = <<HERE;

my $text2 = <<HERE;
%TOC{"$this->{test_web}.$this->{test_topic}"}%
HERE
my $res2 = $topicObject->expandMacros($text );
my $topicObject2 = Foswiki::Meta->new(
$this->{session}, $this->{test_web}, $this->{test_topic}."2", $text2);
$topicObject->save();
my $res2 = $topicObject2->expandMacros($text2 );
$res2 = $topicObject->renderTML( $res2 );

$this->assert_html_equals(<<HTML, $res2);
<a name="foswikiTOC"></a>
<div class="foswikiToc">
<ul>
<li> <a href="#A_level_1_head_33line">A level 1 head!line</a>
<ul>
<li> <a href="#Followed_by_a_level_2_33_headline">
Followed by a level 2! headline</a>
</li>
</ul>
</li>
</ul>
<a name="foswikiTOC"></a><div class="foswikiToc"> <ul>
<li> <a href="/TemporaryTOCTestsTestWebTOCTests/TestTopicTOCTests#A_level_1_head_33line">A level 1 head!line</a> <ul>
<li> <a href="/TemporaryTOCTestsTestWebTOCTests/TestTopicTOCTests#Followed_by_a_level_2_33_headline">Followed by a level 2! headline</a>
</li></ul>
</li></ul>
</div>
<nop><h1><a name="A_level_1_head_33line"></a> A level 1 head!line </h1>
<nop><h2><a name="Followed_by_a_level_2_33_headline"></a>
Followed by a level 2! headline </h2>
<nop><h2><a name="Another_level_2_headline"></a>
Another level 2 headline </h2>
HTML
}

Expand Down
4 changes: 2 additions & 2 deletions core/lib/Foswiki/Macros/TOC.pm
Expand Up @@ -36,8 +36,8 @@ sub TOC {
if ( $tocTopic || $tocWeb ) {
$tocWeb ||= $topicObject->web;
$tocTopic ||= $topicObject->topic;
( $tocTopic, $tocWeb ) =
$this->normalizeWebTopicName( $tocTopic, $tocWeb );
( $tocWeb, $tocTopic ) =
$this->normalizeWebTopicName( $tocWeb, $tocTopic );

if ( $tocWeb eq $topicObject->web && $tocTopic eq $topicObject->topic )
{
Expand Down

0 comments on commit 0d4586b

Please sign in to comment.