2
# monthly_autopagerize.rb - tDiary plugin
4
# add <link rel="prev"> and <link rel="next"> tags for AutoPagerize at monthly mode
6
# Copyright (C) 2009 MATSUI Shinsuke <poppen@karashi.org>
7
# You can redistribute it and/or modify it under GPL2.
10
if @mode == 'month' then
12
stream = @conf['monthly_autopagerize.stream'] || 0
16
@years.keys.each do |y|
17
ym += @years[y].collect {|m| y + m}
20
now = @date.strftime( '%Y%m' )
21
return '' unless ym.index( now )
22
prev_month = ym.index( now ) == 0 ? nil : ym[ym.index( now )-1]
23
next_month = ym[ym.index( now )+1]
27
# rel_prev_month = 'next'
28
# rel_next_month = 'prev'
30
rel_prev_month = 'prev'
31
rel_next_month = 'next'
33
rel_prev_month = 'next'
34
rel_next_month = 'prev'
38
result << %Q[<link rel="#{rel_prev_month}" title="#{h navi_prev_month}" href="#{h @index}#{anchor( prev_month )}">\n\t]
41
result << %Q[<link rel="#{rel_next_month}" title="#{h navi_next_month}" href="#{h @index}#{anchor( next_month )}">\n\t]
48
add_conf_proc( 'monthly_autopagerize', 'Monthly AutoPagerize' ) do
49
if @mode == 'saveconf' then
50
@conf['monthly_autopagerize.stream'] = @cgi.params['monthly_autopagerize.stream'][0].to_i
53
<h3>Stream of Monthly AutoPagerize</h3>
54
<p><select name="monthly_autopagerize.stream">
55
<option value="0"#{' selected' if @conf['monthly_autopagerize.stream'] == 0}>To Past</option>
56
<option value="1"#{' selected' if @conf['monthly_autopagerize.stream'] == 1}>To Future</option>
65
# ruby-indent-level: 3