# recent_entry.rb $Revision: 1.13 $ # # recent_entry: modified 'title_list' for Blogkit. # parameter(default): # max: maximum list items (5) # limit: max lengh of each items (20) # # Copyright (c) 2002 TADA Tadashi # Copyright (c) 2001,2002 Junichiro KITA # You can redistribute it and/or modify it under GPL2. # def recent_entry( max = 5, limit = 20 ) result = "\n" apply_plugin( result ) end #---- private ----# def recent_entry_secure( max = 5, limit = 20 ) max = max.to_i limit = limit.to_i result = '' @diaries.keys.sort.reverse.each_with_index do |date, idx| break if idx >= max diary = @diaries[date] next unless diary.visible? title = if diary.respond_to?( :stripped_title ) then diary.stripped_title.gsub( /<[^>]*>/, '' ) else diary.title.gsub( /<[^>]*>/, '' ) end title = 'no title' if title.empty? result << %Q[
  • #{@conf.shorten( title, limit )}
  • \n] end result end eval( <]*>/, '' ) else title = m.diaries[date].title.gsub( /<[^>]*>/, '' ) end title = 'no title' if title.empty? result << %Q|
  • #{@conf.shorten( title, limit )}
  • \n| max -= 1 throw :exit if max == 0 end end end } result end # Local Variables: # mode: ruby # indent-tabs-mode: t # tab-width: 3 # ruby-indent-level: 3 # End: