Changeset 4140


Ignore:
Timestamp:
06/15/09 08:47:52 (3 years ago)
Author:
DanielRohde
Message:

Item1652: added missing BASEWEB/BASETOPIC substitutions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HolidaylistPlugin/lib/Foswiki/Plugins/HolidaylistPlugin.pm

    r4099 r4140  
    4848    ); 
    4949 
    50 # This should always be $Rev: 18100 $ so that TWiki can determine the checked-in 
     50# This should always be $Rev: 18101 $ so that TWiki can determine the checked-in 
    5151# status of the plugin. It is used by the build automation tools, so 
    5252# you should leave it alone. 
    53 $VERSION = '$Rev: 18100 $'; 
     53$VERSION = '$Rev: 18101 $'; 
    5454 
    5555# This is a free-form string you can use to "name" your own plugin version. 
     
    15431543        } 
    15441544 
     1545        $text =~ s/%BASETOPIC%/${theTopic}/sg; 
     1546        $text =~ s/%BASEWEB%/${theWeb}/sg; 
    15451547        $text =~ s/%INCLUDE{(.*?)}%/&expandIncludedEvents($1, \@processedTopics, $web, $topic)/geo; 
    15461548        $text =~s/\%HOLIDAYLIST({(.*?)})?%//sg; 
    15471549        $text = Foswiki::Func::expandCommonVariables($text,$web,$topic); 
     1550 
    15481551         
    15491552        return $text; 
     
    15671570sub expandIncludedEvents 
    15681571{ 
    1569         my( $theAttributes, $theProcessedTopicsRef, $theWeb, $theTopic ) = @_; 
    1570  
    1571         my $webTopic = Foswiki::Func::expandCommonVariables( Foswiki::Func::extractNameValuePair( $theAttributes ), $theTopic, $theWeb ); 
    1572         my $section = Foswiki::Func::expandCommonVariables( Foswiki::Func::extractNameValuePair( $theAttributes, 'section'), $theTopic, $theWeb ); 
    1573         my $pattern = Foswiki::Func::expandCommonVariables( Foswiki::Func::extractNameValuePair( $theAttributes, 'pattern'), $theTopic, $theWeb ); 
     1572        my( $theAttributes, $theProcessedTopicsRef, $web, $topic ) = @_; 
     1573 
     1574        my $webTopic = Foswiki::Func::expandCommonVariables( Foswiki::Func::extractNameValuePair( $theAttributes ), $topic, $web ); 
     1575        my $section = Foswiki::Func::expandCommonVariables( Foswiki::Func::extractNameValuePair( $theAttributes, 'section'), $topic, $web ); 
     1576        my $pattern = Foswiki::Func::expandCommonVariables( Foswiki::Func::extractNameValuePair( $theAttributes, 'pattern'), $topic, $web ); 
    15741577 
    15751578         
    15761579        if( $webTopic =~ /^([^\.]+)[\.\/](.*)$/ ) { 
    1577                 $theWeb = $1; 
    1578                 $theTopic = $2; 
     1580                $web = $1; 
     1581                $topic = $2; 
    15791582        } else { 
    1580                 $theTopic = $webTopic; 
     1583                $topic = $webTopic; 
    15811584        } 
    15821585 
    15831586        # prevent recursive loop: 
    1584         grep (/^\Q$theWeb.$theTopic\E$/, @{$theProcessedTopicsRef}) and return ""; 
    1585  
    1586         push( @{$theProcessedTopicsRef}, "$theWeb.$theTopic" ); 
    1587  
    1588         my $text = &readTopicText( $theWeb, $theTopic ); 
     1587        grep (/^\Q$web.$topic\E$/, @{$theProcessedTopicsRef}) and return ""; 
     1588 
     1589        push( @{$theProcessedTopicsRef}, "$web.$topic" ); 
     1590 
     1591        my $text = &readTopicText( $web, $topic ); 
    15891592 
    15901593        $text = getTopicSectionText($text, $section) if (defined $section && $section ne ""); 
     
    15941597        $text = getTopicIncludeText($text); 
    15951598 
     1599        # fix base topic: 
     1600        $text =~ s/%BASETOPIC%/${theTopic}/sg; 
     1601        $text =~ s/%BASEWEB%/${theWeb}/sg; 
     1602 
    15961603        # recursively expand includes: 
    1597         $text =~ s/%INCLUDE{(.*?)}%/&expandIncludedEvents( $1, $theProcessedTopicsRef, $theWeb, $theTopic )/geo; 
     1604        $text =~ s/%INCLUDE{(.*?)}%/&expandIncludedEvents( $1, $theProcessedTopicsRef, $web, $topic )/geo; 
    15981605 
    15991606        # expand common variables: 
Note: See TracChangeset for help on using the changeset viewer.