Skip to content

Commit

Permalink
Item10151: Fix inter-wiki's with paranthesis
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/branches/Release01x01@10301 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
AndrewJones authored and AndrewJones committed Dec 13, 2010
1 parent aea9895 commit 5cbceee
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
5 changes: 3 additions & 2 deletions InterwikiPlugin/data/System/InterwikiPlugin.txt
Expand Up @@ -53,10 +53,11 @@ The =INTERWIKIPLUGIN_INTERLINKFORMAT= supports a number of formatting tokens:
| Version: | %$VERSION% |
| Release: | %$RELEASE% |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| 10 Dec 2010: | Foswiki:Main.AndrewJones - Allow the =INTERWIKIPLUGIN_RULESTOPIC= to be a comma separated list. Implements Foswiki:Development/InheritWikiLinksTopics. |
| 13 Dec 2010: | Foswiki:Main.AndrewJones - Fix inter-wiki's with paranthesis (Foswikitask:Item10151) |
| 10 Dec 2010: | Foswiki:Main.AndrewJones - Allow the =INTERWIKIPLUGIN_RULESTOPIC= to be a comma separated list. Implements Foswiki:Development/InheritWikiLinksTopics |
| 12 Jul 2010: | Foswiki:Main.AndrewJones - Check access controls on !InterWikis topic |
| 10 Jul 2010: | =mod_perl= and =FastCGI= compatible |
| 20 Sep 2009: | Version from 15 Apr now included with Foswiki 1.0.7. |
| 20 Sep 2009: | Version from 15 Apr now included with Foswiki 1.0.7 |
| 15 Apr 2009: | Foswiki:Main.CrawfordCurrie - removed plugin preferences from this topic |
| 16 Dec 2008: | Foswiki:Main.KennethLavrsen - Foswiki version - no features changed |
| 03 Aug 2008: | TWiki 4.2.1 release version |
Expand Down
6 changes: 3 additions & 3 deletions InterwikiPlugin/lib/Foswiki/Plugins/InterwikiPlugin.pm
Expand Up @@ -27,7 +27,7 @@ use Foswiki::Func (); # The plugins API
use Foswiki::Plugins (); # For the API version

our $VERSION = '$Rev$';
our $RELEASE = '10 Dec 2010';
our $RELEASE = '13 Dec 2010';
our $NO_PREFS_IN_TOPIC = 1;
our $SHORTDESCRIPTION =
'Link !ExternalSite:Page text to external sites based on aliases defined in a rules topic';
Expand Down Expand Up @@ -56,7 +56,7 @@ sub initPlugin {
%interSiteTable = ();
$sitePattern = "([$ua][$man]+)";
$pagePattern =
"([${man}_\/][$man" . '"\'\.\/\+\_\,\&\;\:\=\!\?\%\#\@\-]*?)';
"([${man}_\/][$man" . '"\'\.\/\+\_\,\&\;\:\=\!\?\%\#\@\-\(\)]*?)';

# Get plugin preferences from InterwikiPlugin topic
$interLinkFormat =
Expand Down Expand Up @@ -113,7 +113,7 @@ s/(\[\[)$sitePattern:$pagePattern(\]\]|\]\[[^\]]+\]\])/_link($1,$2,$3,$4)/ge;

# ref in text
$_[0] =~
s/(^|[\s\-\*\(])$sitePattern:$pagePattern(?=[\s\.\,\;\:\!\?\)\|]*(\s|$))/_link($1,$2,$3)/ge;
s/(^|[\s\-\*\(])$sitePattern:$pagePattern(?=[\s\.\,\;\:\!\?\|]*(\s|$))/_link($1,$2,$3)/ge;

return;
}
Expand Down
Expand Up @@ -179,4 +179,13 @@ HERE
);
}

# http://foswiki.org/Tasks/Item10151
sub test_link_with_parentheses {
my $this = shift;
$this->assert_html_equals(
'<a class="interwikiLink" href="http://en.wikipedia.org/wiki/Fork_(software_development)" title="\'Fork_(software_development)\' on \'Wikipedia\'"><noautolink>Wikipedia:Fork_(software_development)</noautolink></a>',
Foswiki::Func::renderText( "Wikipedia:Fork_(software_development)", $this->{test_web} )
);
}

1;

0 comments on commit 5cbceee

Please sign in to comment.