Skip to content

Commit

Permalink
Item9614: fixed bogus regex that was supposed to disable links, but e…
Browse files Browse the repository at this point in the history
…nded up cabbaging them.

git-svn-id: http://svn.foswiki.org/branches/Release01x00@8865 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
CrawfordCurrie authored and CrawfordCurrie committed Sep 3, 2010
1 parent b78ce6d commit 9b79e70
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions core/lib/Foswiki/UI/Preview.pm
Expand Up @@ -111,8 +111,7 @@ sub preview {
$session->renderer->getRenderedVersion( $displayText, $web, $topic );

# Disable links and inputs in the text
$displayText =~
s#<a\s[^>]*>(.*?)</a>#<span class="foswikiEmulatedLink">$1</span>#gis;
$displayText =~ s#(<a\s[^>]*>)(.*?)(</a>)#_disableLink($1, $2, $3)#gies;
$displayText =~ s/<(input|button|textarea) /<$1 disabled="disabled" /gis;
$displayText =~ s(</?form(|\s.*?)>)()gis;
$displayText =~ s/(<[^>]*\bon[A-Za-z]+=)('[^']*'|"[^"]*")/$1''/gis;
Expand Down Expand Up @@ -156,6 +155,15 @@ sub preview {
$session->writeCompletePage($tmpl);
}

sub _disableLink {
my ($one, $two, $three) = @_;
if ($one =~ /\bhref=/) {
$one = "<span class=\"foswikiEmulatedLink\">";
$three = "</span>";
}
return "$one$two$three";
}

1;
__DATA__
# Module of Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Expand Down

0 comments on commit 9b79e70

Please sign in to comment.