svnno****@sourc*****
svnno****@sourc*****
2009年 4月 6日 (月) 17:37:42 JST
Revision: 1109 http://svn.sourceforge.jp/view?root=slashdotjp&view=rev&rev=1109 Author: tach Date: 2009-04-06 17:37:42 +0900 (Mon, 06 Apr 2009) Log Message: ----------- * Enable to select adding "rel=nofollow" to anchor or not using regex by constants "nofollow_exclude_regex" Modified Paths: -------------- slashjp/trunk/Slash/Utility/Data/Data.pm slashjp/trunk/debian/changelog -------------- next part -------------- Modified: slashjp/trunk/Slash/Utility/Data/Data.pm =================================================================== --- slashjp/trunk/Slash/Utility/Data/Data.pm 2009-04-06 07:40:25 UTC (rev 1108) +++ slashjp/trunk/Slash/Utility/Data/Data.pm 2009-04-06 08:37:42 UTC (rev 1109) @@ -2547,10 +2547,20 @@ sub noFollow { my($html) = @_; - $html =~ s/(<a href=.+?)>/$1 rel="nofollow">/gis; + $html =~ s/(<a\s+(?:[^>]*?\s)?href=[^>]+?)>/&_noFollowStr($1)/geis; return $html; } +sub _noFollowStr { + my($str) = @_; + next unless ($str =~ /href="?(.*?)(?:"|\s|$)/); + my $url = $1; + my $regex = getCurrentStatic('nofollow_exclude_regex'); + if (!$regex || $url !~ $regex) { + $str .= ' rel="nofollow"'; + } + return $str . '>'; +} # DOCUMENT after we remove some of this in favor of Modified: slashjp/trunk/debian/changelog =================================================================== --- slashjp/trunk/debian/changelog 2009-04-06 07:40:25 UTC (rev 1108) +++ slashjp/trunk/debian/changelog 2009-04-06 08:37:42 UTC (rev 1109) @@ -26,8 +26,10 @@ - prevent to send all runtask messages * Force to add "rel=nofollow" to anchor on displayJournal() when constants "journal_force_nofollow" has set. + * Enable to select adding "rel=nofollow" to anchor or not using regex by + constants "nofollow_exclude_regex" - -- Taku YASUI <tach****@osdn*****> Mon, 6 Apr 2009 04:57:59 +0000 + -- Taku YASUI <tach****@osdn*****> Mon, 6 Apr 2009 07:42:30 +0000 slash (2.5.0.233-7) unstable; urgency=low