タオ投稿用の html ファイルに翻訳するスクリプトを書いた。 (おっと横幅が入り切らない…)
#!/usr/bin/ruby
filename = ARGV[0]
/([0-9])-[0-9]/ =~ filename
section = $1
sectiontitle = ["静かなる空虚", "古の師たち", "デザイン",
"コーディング", "メンテナンス", "マネジメント",
"企業の知恵", "ハードウェアとソフトウェア", "結語"]
wfile = open(filename + ".html", "w")
wfile.print("<P>\n今日の \"The Tao of Programming\"(G.James/InfoBooks)。",
"原による試訳。\n</P>\n<BLOCKQUOTE>\n<P>\n")
rfile = open(filename)
while line = rfile.gets do
if /^PP$/ =~ line then
wfile.puts("</P>\n<P>")
else
wfile.print(line)
end
end
rfile.close
wfile.print("</P>\n</BLOCKQUOTE>\n<P>\n「プログラミングのタオ」")
wfile.print(" 第", section, "の書")
wfile.print("「", sectiontitle[section.to_i - 1], "」、", filename, "章\n</P>")
wfile.close