From: "Stephan Kämper" Date: 2004-06-15T08:18:35+09:00 Subject: RedCloth problem with a nested list Hi all, The test given below leaves me with this result: Loaded suite E:/test_redcloth_nestedlist Started F. Finished in 0.03 seconds. 1) Failure: test_all_in_one_go(Test_Nested_List) [E:/test_redcloth_nestedlist.rb:15]: Exception raised: Class: Message: <"undefined method `length' for nil:NilClass"> ---Backtrace--- C:/ruby/lib/ruby/site_ruby/1.8/redcloth.rb:457:in `lists' C:/ruby/lib/ruby/site_ruby/1.8/redcloth.rb:446:in `each_with_index' C:/ruby/lib/ruby/site_ruby/1.8/redcloth.rb:446:in `each' C:/ruby/lib/ruby/site_ruby/1.8/redcloth.rb:446:in `each_with_index' C:/ruby/lib/ruby/site_ruby/1.8/redcloth.rb:446:in `lists' C:/ruby/lib/ruby/site_ruby/1.8/redcloth.rb:442:in `gsub!' C:/ruby/lib/ruby/site_ruby/1.8/redcloth.rb:442:in `lists' C:/ruby/lib/ruby/site_ruby/1.8/redcloth.rb:787:in `inline' C:/ruby/lib/ruby/site_ruby/1.8/redcloth.rb:239:in `to_html' E:/test_redcloth_nestedlist.rb:14:in `test_all_in_one_go' E:/test_redcloth_nestedlist.rb:12:in `assert_nothing_raised' E:/test_redcloth_nestedlist.rb:15:in `test_all_in_one_go' --------------- 2 tests, 3 assertions, 1 failures, 0 errors Im running Ruby 1.8.1 from the 1-click-installer on WinXP using RedCloth 2.0.11. The same happenes when running the test using Linux While it doesn't make too much sense to have this order of '*' and '**', the given situation is the smallest and closest piece of RedCloth I could com up with that shows this behaviour. The original data ia a list with a sublist with one line similar to "!pic/pic.png!:http://www.rubygarden.org/". In _that_ situation the result is the same ("undefined method `length' for nil:NilClass"), except that the problem disappears after inserting a space before the line containing the link. May be I'll dig a bit deeper into this tomorrow... Am I missing something? May be it's time to get me some sleep. ;-) Happy rubying Stephan >>>> Ruby test begin <<<< require 'test/unit' require 'redcloth' class Test_Nested_List < Test::Unit::TestCase def setup @lines = DATA.readlines.join( '' ) end def test_all_in_one_go assert_equal( "2.0.11", RedCloth::VERSION ) assert_nothing_raised do r = RedCloth.new( @lines ) r_htmlized = r.to_html end end def test_each_line_for_itself assert_nothing_raised do r = RedCloth.new( '' ) @lines.each do | line | r = RedCloth.new( line ) r_htmlized += r.to_html end end end end __END__ ** And another !pic/pic.png!:http://www.rubygarden.org/ * another item >>>> Ruby test end <<<<