# today.rb v1.2 2002.12.2 by ippo # today.rb v1.3 2003.5.19 by ippo #CSS化 # (modefied- enikki.rb,v 1.2 2001/09/03 22:54:46 not Exp) =begin LOG_DIRECTORYフォルダにある「なんの日?ファイル」を読み込み、毎日の冒頭に。 ファイル名は「todaysf.txt」、フォーマットは各行「MMDD(tab)date(tab)string」 =end class Filter @@today_file = 'todaysf.txt' @@today_url = 'http://homepage2.nifty.com/URU/' def today(str, type) if @todaylist.nil? then @todaylist = [] open(@diary.logDirectory + @@today_file).each{ |line| line = line.split("\t") date = line.shift time = '0101' if date =~ /(\d\d)(\d\d)/ then #月、日のdateデータ time = $1 time << $2 end @todaylist << [time, line] } end case type when :ONEDAY list = @todaylist.find_all{ |time, data| time == @diary.date[4..7]} if list.size > 0 then info = '
' << "\n" list.each{ |time, data| info << data.join(" ").strip << '
' << "\n" } mo = Time::local(@diary.date[0..3], @diary.date[4..5], @diary.date[6..7]).strftime("%b").downcase md = @diary.date[4..7] unless @@today_url.nil? ref = '' info.chomp!("
\n") info << "\n" << ref << "\n" end info << '
' << "\n" str.replace("<<\n" + info + "\n\n" + str) end end end end