=begin  データ「topic」の中身は  200204   16    _t1,▽話題    _t2,▽話題とか    _t3,■読んだ本とか   17   18   ...  という構造。  だから、year,month,date(例えば2002,04,16)からファイルポインタ(例えば200204.html#16)を作る関数date2url(year,month,date)というのがあったとして、i番目のトピックは、  urlは、  date2url(year,month,date) + topic[year+month][date][i][0]  その時のstrは、  topic[year+month][i][1]  となる。 =end require 'kconv' class Topics def select_tohtml(diarys, putmonth = true, year = '') @diarys = diarys topic = Marshal::load(filter_topics(diarys)) pattern = Regexp::compile(@pattern) body = '' topic.delete_if{ |month, days| days.delete_if{ |date, topics| topics.delete_if{ |line| pattern !~ line[1] } topics.size.zero? or !diarys.include?(month + date) } days.size.zero? } topic.keys.sort.reverse.each{ |month| topic[month].keys.sort.each{ |date| body << "\t\t
  • #{date} : " body << topic[month][date].collect!{ |t| str = t[1] str = t[1].gsub(pattern,@replace) unless @replace.nil? "#{str}" }.join(' / ') body << "
  • \n" } } if putmonth then return "
    \n" + body + "
    \n" else return "\n" end end end def plug(opt) t = Topics::new t.topicDateFormat = opt['dateformat'] if opt['dateformat'] t.pattern = Kconv.kconv(opt['pattern'],3) if opt['pattern'] t.replace = nil t.replace = Kconv.kconv(opt['replace'],3) if opt['replace'] t.skelton = self.skelton t.diary = self putmonth = self.kind_of?(LastDiary) ? true : false str = t.select_tohtml(@diarys, putmonth) if self.kind_of?(PastDiary) then str.gsub!(@targetMonth + @monthPartNames[@diarys[0][6..7].to_i] + ".html", '') end return str end