#
# simple_autopagerize.rb - tDiary plugin
#
# add and tags for AutoPagerize
#
# Copyright (C) 2008 MATSUI Shinsuke
# You can redistribute it and/or modify it under GPL2.
#
return unless /^(latest|month)$/ =~ @mode
add_header_proc do
result = String.new
case @mode
when 'latest'
if @conf['ndays.prev'] then
result << %Q[\n\t]
end
if @conf['ndays.next'] then
result << %Q[\n\t]
end
when 'month'
ym = []
@years.keys.each do |y|
ym += @years[y].collect {|m| y + m}
end
ym.sort!
now = @date.strftime( '%Y%m' )
return '' unless ym.index( now )
prev_month = ym.index( now ) == 0 ? nil : ym[ym.index( now )-1]
next_month = ym[ym.index( now )+1]
if prev_month then
result << %Q[\n\t]
end
if next_month then
result << %Q[\n\t]
end
end
result.chop.chop
end
# Local Variables:
# mode: ruby
# indent-tabs-mode: t
# tab-width: 3
# ruby-indent-level: 3
# End:
# vi: ts=3 sw=3