#
# autopagerize.rb - tDiary plugin
#
# add and tags for AutoPagerize
#
# Copyright (C) 2008 MATSUI Shinsuke
# You can redistribute it and/or modify it under GPL2.
#
#
# HTML header
#
def index_page_tag
result = ''
if @index_page and @index_page.size > 0 then
result << %Q[\n\t]
end
case @mode
when 'day'
if @prev_day then
result << %Q[\n\t]
end
if @next_day then
result << %Q[\n\t]
end
when 'nyear'
if @prev_day then
result << %Q[\n\t]
end
if @next_day then
result << %Q[\n\t]
end
when 'month'
unless (months = _create_month).empty? then
prev_month = months['prev_month']
next_month = months['next_month']
if prev_month then
result << %Q[\n\t]
end
if next_month then
result << %Q[\n\t]
end
end
when 'latest'
if @conf['ndays.prev'] then
result << %Q[\n\t]
end
if @conf['ndays.next'] then
result << %Q[\n\t]
end
end
result << %Q[\n\t]
result.chop.chop
end
def _create_month
result = {}
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 )
result['prev_month'] = ym.index( now ) == 0 ? nil : ym[ym.index( now )-1]
result['next_month'] = ym[ym.index( now )+1]
result
end
# Local Variables:
# mode: ruby
# indent-tabs-mode: t
# tab-width: 3
# ruby-indent-level: 3
# End:
# vi: ts=3 sw=3