Sha256: f701c0a76fd740825bb3b18438cf8803364f5cb9cce1f258cbbf2a7935c40de8

Contents?: true

Size: 1.25 KB

Versions: 21

Compression:

Stored size: 1.25 KB

Contents

# 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 <t@tdtds.jp>
# Copyright (c) 2001,2002 Junichiro KITA <kita@kitaj.no-ip.com>
# You can redistribute it and/or modify it under GPL.
#
require 'tdiary/diary_container'

def recent_entry(max = 5, limit = 20)
	max = max.to_i
	limit = limit.to_i

	result = "<ul>\n"
	catch(:exit) {
		@years.keys.sort.reverse_each do |year|
			@years[year].sort.reverse_each do |month|
				m = DiaryContainer::find_by_month(@conf, "#{year}#{month}")
				m.diaries.keys.sort.reverse_each do |date|
					next unless m.diaries[date].visible?
					title = if m.diaries[date].respond_to?(:stripped_title) then
						title = m.diaries[date].stripped_title.gsub(/<[^>]*>/, '')
					else
						title = m.diaries[date].title.gsub(/<[^>]*>/, '')
					end
					title = 'no title' if title.empty?
					result << %Q|<li><a href="#{h @index}#{anchor date}">#{@conf.shorten(title, limit)}</a></li>\n|
					max -= 1
					throw :exit if max == 0
				end
			end
		end
	}
	result << "</ul>\n"
	apply_plugin(result)
end

# Local Variables:
# mode: ruby
# indent-tabs-mode: t
# tab-width: 3
# ruby-indent-level: 3
# End:

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
tdiary-blogkit-5.3.0 plugin/recent-entry.rb
tdiary-blogkit-5.2.4 plugin/recent-entry.rb
tdiary-blogkit-5.2.3 plugin/recent-entry.rb
tdiary-blogkit-5.2.2 plugin/recent-entry.rb
tdiary-blogkit-5.2.1 plugin/recent-entry.rb
tdiary-blogkit-5.2.0 plugin/recent-entry.rb
tdiary-blogkit-5.1.7 plugin/recent-entry.rb
tdiary-blogkit-5.1.6 plugin/recent-entry.rb
tdiary-blogkit-5.1.5 plugin/recent-entry.rb
tdiary-blogkit-5.1.4 plugin/recent-entry.rb
tdiary-blogkit-5.1.3 plugin/recent-entry.rb
tdiary-blogkit-5.1.2 plugin/recent-entry.rb
tdiary-blogkit-5.1.1 plugin/recent-entry.rb
tdiary-blogkit-5.1.0 plugin/recent-entry.rb
tdiary-blogkit-5.0.13 plugin/recent-entry.rb
tdiary-blogkit-5.0.12 plugin/recent-entry.rb
tdiary-blogkit-5.0.11 plugin/recent-entry.rb
tdiary-blogkit-5.0.10 plugin/recent-entry.rb
tdiary-blogkit-5.0.9 plugin/recent-entry.rb
tdiary-blogkit-5.0.8 plugin/recent-entry.rb