#38 ✓resolved
VirtualFunction

Dim inline element fails in 4.0.2 due to empty opts

Reported by VirtualFunction | August 16th, 2008 @ 08:57 PM | in 4.0.3

Just to keep you on your toes Jason, here's another bug!

RedCloth.new("p. The Room is 3 x 4 inches big!\n\n").to_html

yields

NoMethodError: private method gsub!' called for nil:NilClass

from /usr/lib/ruby/gems/1.8/gems/RedCloth-4.0.2/lib/redcloth/formatters/html.rb:192:in `dim'

It appears that an empty hash is being sent to the dim method here.

This does not happen in 4.0.1, just 4.0.2. However all the test cases seem to pass for me, which suggests this has been broken but no test cases exist for it.

Comments and changes to this ticket

  • VirtualFunction

    VirtualFunction August 16th, 2008 @ 09:25 PM

    OK, done a bit of research. Not 100% sure on the claim about Redcloth 4.0.1 being OK tbh (Can't be bothered to install the older version and that's not the major issue here).

    Having looked, obviously there are tests for the dim feature. (I was going to say/think it would be odd not having any given the 4900+ assertions!). It appears all the tests seem to pass oddly... However when I add the following above the other dim tests in basic.yml


    name: dimension sign desc: The letter 'x' becomes a dimension sign when used between digits. in: "The room is 2x3 inches big\n\n" html: "

    The room is 2×3 inches big.

    "

    I get the error. What's more is that the following tests relating to dim that were passing also fail (well raise the same error). To me this hints the possibility of hidden/global state in the parser is being set and is leaking to following tests.

  • VirtualFunction

    VirtualFunction August 16th, 2008 @ 09:26 PM

    <![CDATA[


    name: dimension sign desc: The letter 'x' becomes a dimension sign when used between digits. in: "The room is 2x3 inches big\n\n" html: "

    The room is 2×3 inches big.

    " ]]>

    Damn it, YAML reposted. Was hoping my YAML was not going to get eaten!

  • VirtualFunction
  • VirtualFunction

    VirtualFunction August 16th, 2008 @ 09:29 PM

    I give up, here it is in an aptly named attachment :-)

  • Jason Garber

    Jason Garber August 18th, 2008 @ 09:55 AM

    It's not actually the following tests also failing; it's variations on the same test (test_sanitized-, test_no_span_caps-, -raises_nothing).

    What's happening is the space confuses it into thinking perhaps another dimension is coming. "2x3x4 inches big" works and so does "2x3in." It's that darned space that I have to fix.

  • Jason Garber

    Jason Garber August 18th, 2008 @ 11:58 AM

    • State changed from “new” to “resolved”

    (from [9228a8f57df1a56ca52c8888007f5b48091566a2]) Fix NoMethodError: private method gsub!' called for nil:NilClass when two dimensions followed by a space. [#38 state:resolved] http://github.com/jgarber/redclo...

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

RedCloth is a Ruby library for converting Textile into HTML

Shared Ticket Bins

People watching this ticket

Attachments

Tags

Referenced by

Pages