ひさしぶりに RT を使った RD ファイルに rd2 (rdrt2) をかけたらこんなエラーメッセージが出て失敗した。
$ rdrt2 -r rd/rd2html-ext-lib --out-code=utf8 --native-inline --ref-extension aaa.rd > aaa.html /opt/local/lib/ruby/site_ruby/1.8/rd/search-file.rb:7:in `+': can't convert nil into String (TypeError) from /opt/local/lib/ruby/site_ruby/1.8/rd/search-file.rb:7:in `search_file' from /opt/local/lib/ruby/site_ruby/1.8/rd/search-file.rb:6:in `each' from /opt/local/lib/ruby/site_ruby/1.8/rd/search-file.rb:6:in `search_file' from /opt/local/lib/ruby/site_ruby/1.8/rd/search-file.rb:5:in `each' from /opt/local/lib/ruby/site_ruby/1.8/rd/search-file.rb:5:in `search_file' from /opt/local/lib/ruby/site_ruby/1.8/rd/output-format-visitor.rb:23:in `apply_to_Include' from (eval):2:in `visit_Include' from /opt/local/lib/ruby/site_ruby/1.8/rd/block-element.rb:65:in `accept' from /opt/local/lib/ruby/site_ruby/1.8/rd/visitor.rb:20:in `visit_children' from /opt/local/lib/ruby/site_ruby/1.8/rd/element.rb:45:in `each_child' from /opt/local/lib/ruby/site_ruby/1.8/rd/element.rb:44:in `each' from /opt/local/lib/ruby/site_ruby/1.8/rd/element.rb:44:in `each_child' from /opt/local/lib/ruby/site_ruby/1.8/rd/visitor.rb:19:in `visit_children' from (eval):2:in `visit_DocumentElement' from /opt/local/lib/ruby/site_ruby/1.8/rd/element.rb:144:in `accept' from /opt/local/lib/ruby/site_ruby/1.8/rd/tree.rb:78:in `accept' from /opt/local/lib/ruby/site_ruby/1.8/rd/visitor.rb:14:in `visit' from /opt/local/lib/ruby/site_ruby/1.8/rd/rd2html-lib.rb:62:in `visit' from /opt/local/lib/ruby/site_ruby/1.8/rd/rd2html-ext-lib.rb:42:in `visit' from /opt/local/bin/rd2:241 $
調べてみたら、どうも rd2 が optparse の古いあるいは隠し機能を使ってるみたいだった。こんな風に変えてみた。
--- rd2.orig 2008-01-14 16:40:04.000000000 +0900 +++ rd2 2010-06-23 18:25:52.000000000 +0900 @@ -127,8 +127,14 @@ # accept "PART:FILTER" and "PART" q.on("--with-part=PART", - /(\w+)(?:\s*:\s*(\w+))?/, - "include PART with Filter") do |src, part, filter| + String, + "include PART with Filter") do |i| + if /(\w+)(?:\s*:\s*(\w+))?/ =~ i + part = $1 + filter = $2 + else + raise OptionParser::InvalidArgument, "--with-part=#{i}" + end with_part.push([part, filter || part]) unless include_path.index(RD::RDTree.tmp_dir) include_path.push(RD::RDTree.tmp_dir)
optparse も Ruby もあまり詳しくないからもしかしたら適切な直し方じゃないかも知れないけど、一応動いたみたい。
ん、Firefox で見ると右の方が切れて見えるなぁ。デザイン変えた方がいいのかな。コピペするのは大丈夫みたいだけど。