misc/plugin/recent_comment.rb in tdiary-4.0.2.20140201 vs misc/plugin/recent_comment.rb in tdiary-4.0.3
- old
+ new
@@ -20,11 +20,11 @@
def recent_comment( ob_max = 'OBSOLUTE', sep = 'OBSOLUTE', ob_form = 'OBSOLUTE', ob_except = 'OBSOLUTE' )
recent_comment_init
max = @conf['recent_comment.max']
- form = @conf['recent_comment.date_format']
+ form = @conf['recent_comment.date_format']
except = @conf['recent_comment.except_list']
format = @conf['recent_comment.format']
notfound_msg = @conf['recent_comment.notfound_msg']
comments = []
@@ -32,21 +32,21 @@
index = {}
@diaries.each_value do |diary|
next unless diary.visible?
diary.each_comment_tail( max ) do |comment, idx|
- if (except != '') && (/#{except}/ =~ comment.name)
+ if (except != '') && (/#{except}/ =~ comment.name)
next
end
comments << comment
date[comment.date] = diary.date
index[comment.date] = idx
end
end
-
+
result = []
-
+
comments.sort{|a,b| (a.date)<=>(b.date)}.reverse.each_with_index do |com,idx|
break if idx >= max
a = h(@index) + anchor("#{date[com.date].strftime( '%Y%m%d' )}#c#{'%02d' % index[com.date]}")
# we can not escape anchor() to accomodate number_anchor.rb
popup = h( com.shorten( @conf.comment_length ) )
@@ -54,10 +54,10 @@
date_str = h( com.date.dup.strftime( form ) )
result << "<li>"
result << recent_comment_format(format, idx, a, popup, str, date_str)
result << "</li>\n"
end
-
+
if result.size == 0
notfound_msg
else
%Q|<ol class="recent-comment">\n| + result.join( '' ) + "</ol>\n"
end