--- InterwikiPlugin.pm.1.006 2004-11-19 09:35:13.000000000 +0000 +++ InterwikiPlugin.pm 2005-07-04 19:07:33.000000000 +0000 @@ -2,6 +2,7 @@ # # Copyright (C) 2000-2003 Andrea Sterbini, a.sterbini@flashnet.it # Copyright (C) 2001-2004 Peter Thoeny, peter@thoeny.com +# Copyright (C) 2006 Peter Klausner, pklausner web de # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -37,7 +38,7 @@ %interSiteTable $debug ); -$VERSION = '1.006'; # 19 Sep 2004 +$VERSION = '1.1'; # @(#)$Id: InterwikiPlugin.pm,v 1.5 2005/07/04 19:07:33 peter Exp $ $interSiteLinkRulesTopicName = "InterWikis"; # 'Use locale' for internationalisation of Perl sorting and searching - @@ -81,6 +82,7 @@ || "$installWeb.$interSiteLinkRulesTopicName"; $suppressTooltip = &TWiki::Func::getPreferencesFlag( "INTERWIKIPLUGIN_SUPPRESSTOOLTIP" ); $debug = &TWiki::Func::getPreferencesFlag( "INTERWIKIPLUGIN_DEBUG" ); +$debug = 1; # get the Interwiki site->url map topic return 0 unless( $interTopic ); @@ -92,8 +94,8 @@ # grep "| alias | URL | ..." table and extract into "alias", "URL" list # FIXME: Should be able to do this pipeline with just one regex match - @data = map { split /\s+/, $_, 2 } - map { s/^\|\s*$sitePattern\s*\|\s*(.*?)\s*\|\s*(.*?)\s*\|.*$/$1 $2 $3/os ; $_ } + @data = map { split / /, $_, 2 } + map { s/^\|\s*$sitePattern\s*\|\s*(.*?)\s*\|\s*(.*?)\s*\|.*$/$1 $2 $3/os ; $_ } grep { m/^\|\s*$sitePattern\s*\|.*?\|.*?\|/o } @data; if( $debug ) { my $tmp = join(", " , @data ); @@ -120,12 +122,11 @@ sub handleInterwiki { my( $thePrefix, $theSite, $theTopic, $thePostfix ) = @_; - &TWiki::Func::writeDebug( "- InterwikiPlugin::handleInterwikiSiteLink: (site: $theSite), (topic: $theTopic)" ) if $debug; my $text = ""; if( defined( $interSiteTable{ $theSite } ) ) { - my( $url, $help ) = split( /\s+/, $interSiteTable{ $theSite }, 2 ); + my( $url, $help ) = split( / /, $interSiteTable{ $theSite }, 2 ); my $title = ""; if( ! $suppressTooltip ) { $help =~ s// /goi; @@ -142,6 +143,8 @@ if( $thePostfix ) { $text = "$thePrefix$text]["; $text .= "$theSite\:$theTopic]]" if( $thePostfix eq "]]" ); + } elsif( $text =~ /$theSite\:$theTopic"; }