«前の日記(2001-06-30 Sat) 最新 次の日記(2001-07-02 Mon)» 編集

うにっき


2001-07-01 Sun 距離: 2.26km 積算距離: 3091.6km [長年日記]

_ tDiary

0.9.9.5 でテキストファイルへの書き出しができるようになっています.が,吐き出すテキストファイルをそのまま Namazu へ食わせると,かっこいい出力にならないので,これまで通り自作のスクリプトで偽HTMLを吐き出すことにします.

#!/usr/bin/ruby -Ke
TDIARY_PATH = '/home/uh/public_html/diary'
#DEST_PATH = '/home/uh/tmp/tdiary/text'
#INDEX_PATH = '/home/uh/tmp/tdiary/index'
require "#{TDIARY_PATH}/tdiary"
load "#{TDIARY_PATH}/tdiary.conf"
@data_path.chop! if /\/$/ =~ @data_path
DEST_PATH = "#{@data_path}/text"
INDEX_PATH = "#{@data_path}/index"
begin
  index_mtime = File.mtime("#{INDEX_PATH}/NMZ.status")
rescue
  index_mtime = Time::at(0)
end
Dir["#{@data_path}/??????"].each do |file|
#ARGV.each do |file|
  next if /\/\d{6}$/ !~ file
  PStore::new( file ).transaction do |db|
    db['diary'].each do |date,diary|
#p db['diary']
      next if diary.last_modified < index_mtime
      File::open( "#{DEST_PATH}/#{date}", "w" ) do |o|
	title = date.scan(/(\d{4})(\d\d)(\d\d)/).flatten.join("-")
	o.puts "<title>#{title}</title>"
#        o.puts diary.title
#        diary.each_paragraph do |p| o.write p.text end
	diary.each_paragraph do |p|
  		o.write "<h1>■#{p.subtitle}</h1>\n" if p.subtitle
		o.write "▼#{p.body}" if p.body
		o.puts
	end
      end
    end
  end
end

_ tDiary

1.0.0 がリリースされています.めでたい :)

[]

«前の日記(2001-06-30 Sat) 最新 次の日記(2001-07-02 Mon)» 編集
tDiary tDiary-users