From: Michael Neumann Date: 2004-11-26T08:05:05+09:00 Subject: Strange rdoc error with :section: Hi, I very like the new section feature of rdoc... But when I use it with the newest version of ruby from CVS (ruby 1.9.0 (2004-11-26) [i386-dragonfly1.1]) and the following file: #file: rdoc-test.rb # :section: Test def test end I get the following error: > rdoc rdoc-test.rb: RDoc failure in rdoc-test.rb at or around line 3 column 0 Before reporting this, could you check that the file you're documenting compiles cleanly--RDoc is not a full Ruby parser, and gets confused easily if fed invalid programs. The internal error was: /home/mneumann/Programs/usr/lib/ruby/1.9/rdoc/markup/simple_markup/preprocess.rb:21:in `gsub!': string modified (RuntimeError) from /home/mneumann/Programs/usr/lib/ruby/1.9/rdoc/markup/simple_markup/preprocess.rb:21:in `handle' from /home/mneumann/Programs/usr/lib/ruby/1.9/rdoc/parsers/parse_rb.rb:2287:in `look_for_directives_in' from /home/mneumann/Programs/usr/lib/ruby/1.9/rdoc/parsers/parse_rb.rb:1561:in `parse_toplevel_statements' ############################ This seems to be a very strange Ruby error. With the following patch the problem goes away... but I really don't understand why. =================================================================== RCS file: /var/cvs/src/ruby/lib/rdoc/markup/simple_markup/preprocess.rb,v retrieving revision 1.3 diff -u -r1.3 preprocess.rb --- rdoc/markup/simple_markup/preprocess.rb 19 Feb 2004 03:23:51 -0000 1.3 +++ rdoc/markup/simple_markup/preprocess.rb 25 Nov 2004 23:03:04 -0000 @@ -18,7 +18,7 @@ # as |directive, param| def handle(text) - text.gsub!(/^([ \t#]*):(\w+):\s*(.+)?\n/) do + text.dup.gsub!(/^([ \t#]*):(\w+):\s*(.+)?\n/) do prefix = $1 directive = $2.downcase Regards, Michael