# 2003/09/20 微修正 =begin 日毎巻頭言 日記文中の「Head:」節を、日記文中から除き、日付部に移す。 optoin「-t」でtitleを設定。 example: Head: -t Blue Rain 摩天楼蒼く煙らせる雨は =end class Filter def head(str, type) case type when :DATE_ANCHOR #日付部に巻頭言マーク挿入 str.gsub!(/<\/h4>/, '') when :ONEDAY #「Head:」巻頭言を切取 @header, @header_title = '', '' str.gsub!(/^Head:(?: (-.*?))?(\n(.*?))\n\n/mi){ option, str = $1, $2 if option =~ /^-t(.+)$/ @header_title = $1.strip end @header << str.strip.gsub(/\n/,'
') '' } when :AFTER_ONEDAY #巻頭言挿入(日付部の巻頭言マーク位置に) @header_title = ' title="『' + @header_title + '』"' if @header_title.size > 0 @header = '
' + @header + '
' if @header.size > 0 str.gsub!(//,@header) end end end