# $Id: monthindex.rb,v 1.10 2003/10/07 22:26:41 not Exp $ # 2003/12/27 微修正 =begin monthindex.rb nDiary Plug-in 月別ファイルのインデックス作成 月別のファイルへのリンクのインデックスを作成します。 option: month=en 月名を英語表記にします。 month=1 月名を0無数値表記にします。 title=str インデックスに付けるタイトルを指定します。 style無指定 も
を使わずにインデックスを作成します。 style=table
を使ってインデックスを作成します。 style=flatlist
\n! if opt['title'] t1 << '\n" end t2 = '%Q!\t\n\t\t\n!' t3 = '%Q!\t\t\n!' t4 = '%Q!\t\t\n!' t5 = "\t\n\n" t6 = "
' << opt['title'] << "
#{year}#{monthname[month]}#{monthname[month]}
\n\n" else t1 = "\n
\n" t2 = '%Q!\t#{year} [ !' t3 = '%Q!#{monthname[month]}, !' t4 = '%Q!#{monthname[month]}, !' t5 = " ]
\n" t6 = "
" end html = t1 for year in firstYear..lastYear html << eval(t2) for month in 0..11 unless monthlist[year][month].to_s.empty? html << eval(t3) else html << eval(t4) end end html.chop!.chop! if (opt['style'] == 'simple') || (opt['style'].nil?) html << t5 end html << t6 if opt['dst'] and (not opt['dst'].empty?) then if /^([a-zA-Z]:)?\// !~ opt['dst'] then # opt['dst'] = File::expand_path(opt['dst'], @outputDirectory) opt['dst'] = @outputDirectory + opt['dst'] end begin outfile = open(opt['dst'], "w") outfile.print html outfile.close html = "" rescue Errno::ENOENT $stderr.print "Plug-in error: monthindex > dst file not found!\n" html = "" end end return html end