it “should not add spurious li tags to the end of markup” do
input = “* one\n* two\n* three \n\n”
failing_input = “* one\n* two\n* three \n\n\n”
RedCloth.new(input).to_html.should_not match /
$/
RedCloth.new(failing_input).to_html.should_not match /
$/
end
When I run the spec test in the debugger:
$ rspec -d spec/parser_spec.rb
RedCloth::Formatters::HTML.li_open(opts) is called once for each of the
three list items in the first test:
RedCloth.new(input).to_html.should_not match /<li>$/
and then called again once for each list item in the second test:
RedCloth.new(failing_input).to_html.should_not match /<li>$/
and then it is called a seventh time with this argument:
{:type=>“li_open”, :nest=>0, :text=>""}
Yep, it’s an ugly one. I’ve tried to figure it out last year, but have
never
been able to. Ragel is just too much of a black boxat least to me it is.
I’ve printed state machine diagrams that take up the whole floor trying
to
figure out this stuff. It’s impossible!
I don’t think crazy edge cases like this one will get resolved until I
switch RedCloth to a different architecture that has a little more
transparency.
Yep, it’s an ugly one. I’ve tried to figure it out last year, but have never been
able to. Ragel isjust too much of a black box-at least to me it is. I’ve printed
state machine diagrams that take up the whole floor trying to figure out this
stuff. It’s impossible!
I don’t think crazy edge cases like this one will get resolved until I switch
RedCloth to a different architecture that has a little more transparency.
I was surprised that I was able to find the place to fix the bug as
quickly as I did – I didn’t want to spend much time and wasn’t sure
ragel would come back to me fast enough.
I was very glad there are a bunch of tests – because I sure couldn’t
easily tell that my change wouldn’t break something else important.
What’s your plan for releasing 4.2.4?
In terms of changes in operation since 4.2.3 it looks like just:
I was waiting to release until multi-byte characters in Java were
fixed, but seems like that’s not likely to happen anytime soon. I’ll
go ahead and release. Thanks for the nudge.
I was waiting to release until multi-byte characters in Java were
fixed, but seems like that’s not likely to happen anytime soon. I’ll
go ahead and release. Thanks for the nudge.