# 2003/11/3 微修正 =begin customize =end #日付毎アンカーを「#DD」から「#dDD」へ変更 #通常でもXHTML化すればそうなる =begin module DiaryModule # script/ndiary-lib.rb def date2fileanchor(date) # (isXHTML ? 'd' : '' ) + date[6..7] 'd' + date[6..7] end end =end #日付の曜日に英2文字を追加 class Time # script/lib/dateformat.rb alias strftime2_original strftime2 def strftime2(format_str) return format_str if format_str.empty? format = format_str.dup youbi2a = %w(Sn Mn Te We Th Fr St) youbi2A = %w(Su Mo Tu We Th Fr Sa) format.gsub!(/%2a/, youbi2a[self.wday]) format.gsub!(/%2A/, youbi2A[self.wday]) strftime2_original(format) end end #トピック文字列が生成結果として空文字列になった時「.」を代入 class Topics alias tohtml_original tohtml def tohtml(diaries, putmonth = true, year = '') str = tohtml_original(diaries, putmonth, year) str.gsub!(/(]+?\">)(<\/a>)/){ $1 + '.' + $2 } return str end end #カスタム class Filter def custom(str, type) case type when :P #「Book:」本感想文エリア str.gsub!(/^Book:(?: (-.*))?(\n(.*))*/i){ param = $1 str.gsub!(/^Book:(?: (-.*))?\n/i, "") str = "
" + str + "
" } #「Review:」その他(映像などの)感想文エリア str.gsub!(/^Review:(?: (-.*))?(\n(.*))*/i){ param = $1 str.gsub!(/^Review:(?: (-.*))?\n/i, "") str = "
" + str + "
" } #「Comment:」メモをコメントアウト str.gsub!(/^Comment:(?: (-.*))?(\n(.*))*/i){ param = $1 str.gsub!(/^Comment:(?: (-.*))?\n/i, "") str = "" } #「Dust:」愚痴をコメントアウト str.gsub!(/^Dust:(?: (-.*))?(\n(.*))*/i){ param = $1 str.gsub!(/^Dust:(?: (-.*))?\n/i, "") str = "" } #「Money:」家計簿をコメントアウト str.gsub!(/^Money:(?: (-.*))?(\n(.*))*/i){ param = $1 str.gsub!(/^Money:(?: (-.*))?\n/i, "") str = "" } when :ONEDAY #「Book:」の一行目をトピック「□」としてコピー。 #「」で囲まれたタイトルを『』へ str.gsub!(/^Book:(.*?)\n(.*?)「(.*)」(.*?)\n/i){ replace = "□『"+$3+"』\n\nBook:"+$1+"\n"+$2+"「"+$3+"」"+$4+"\n" } #「Review:」の一行目をトピック「△」としてコピー。 #「」で囲まれたタイトルを『』へ str.gsub!(/^Review:(.*?)\n(.*?)「(.*)」(.*?)\n/i){ replace = "△『"+$3+"』\n\nReview:"+$1+"\n"+$2+"「"+$3+"」"+$4+"\n" } #「Code:」の冒頭改行(1行間が空く)を削除。 when :AFTER_CODE str.gsub!(%r!
\n!){ $&.chomp}
      
    #の行に対して改行を付けないよう削除。
    when :AFTER_P #, :AFTER_UL, :AFTER_DL , :AFTER_TOPIC
      str.gsub!(/-->
/, '-->') str.gsub!(/-->
/, '-->') end end end