# today.rb v1.2 2002.12.2 by ippo # today.rb v1.3 2003.5.19 by ippo #CSS化 # today.rb v1.4a 2003.9.21 by ippo #微修正 # (modefied- enikki.rb,v 1.2 2001/09/03 22:54:46 not Exp) =begin 「今日はなんの日?」毎日冒頭記 LOG_DIRECTORYフォルダにある「なんの日?ファイル」を読み込み、毎日の冒頭に。 データ参照元へのリンクを付す。 ファイル名は「todaysf.txt」 フォーマットは各行「MMDD(tab)date(tab)string」 「#」で始まる行はコメントとして処理 @@today_file, @@today_url, today_reference_url の微修正で、 様々な「なんの日?」に対応できるはず。 =end require 'kconv' class Filter @@today_file = 'todaysf.txt' @@today_url = 'http://homepage2.nifty.com/URU/' # @@today_url = 'http://www.mars.dti.ne.jp/~nakahasi/shimada/nenpyou.html' def today(str, type) if @todaylist.nil? @todaylist = [] open(@diary.logDirectory + @@today_file).each{ |line| next if line =~ /^#/ line = Kconv.tosjis(line).chomp.split("\t") date = line.shift time = '0101' if date =~ /(\d\d)(\d\d)/ #月、日のdateデータ time = $1 + $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 info = '