=begin customize =end #日付毎アンカーを「#NN」から「#dn」へ変更 module DiaryModule def date2fileanchor(date) # date[6..7] "d" + date[6..7].to_i.to_s end end #日付の曜日を英2文字に変更 class Time def strftime2(format_str) youbi2a = %w(Sn Mn Te We Th Fr St) youbi2A = %w(Su Mo Tu We Th Fr Sa) format = format_str.dup format.gsub!(/%2a/, youbi2a[self.wday]) format.gsub!(/%2A/, youbi2A[self.wday]) strftime(format) end end #トピック文字列が生成結果として空文字列になった時「.」を代入 class Topics def tohtml(diaries, putmonth = true, year = '') body = '' @diaries = diaries topic = Marshal::load(filter_topics(diaries)) pattern = Regexp::compile(@pattern) topic.keys.sort.reverse_each{ |month| next unless month[0..3].index(year) monthlink = [] monthhtml = '' topic[month].keys.sort.each{ |date| d = Time::local(month[0..3], month[4..5], date) monthhtml << "\t\t
  • #{d.strftime2(@topicDateFormat)} : " monthhtml << topic[month][date].collect!{ |t| monthlink << "#{@monthPartNames[date.to_i]}" # "#{t[1].gsub(pattern, @replace)}" string = t[1].gsub(pattern, @replace) string = "." if string == "" "#{string}" }.join(' / ') monthhtml << "
  • \n" } if putmonth then m = Time::local(month[0..3], month[4..5]) if @monthPartNames.uniq.size == 1 then body << "\t
    " body << "#{m.strftime2(@topicMonthFormat)}
    \n\t