Another possible bug

This is to do with URL processing it appears to be isolated to image tag
URL parsing (doesn’t seem to be affected by normal URLs).

puts RedCloth.new(’!../…/index.html!’).to_html

Returns:

It trims the any number dots before the first / in relative URL’s. I
kind of depend on this as the code I’m generating is part of a
publishing system that needs to be able to handle relative links so
pages can be distributed offline.

On a side note, congrats Jason on the rewrite! Will it be long before
this new version becomes standard?

Cheers
Jase.

This is to do with URL processing it appears to be isolated to image tag
URL parsing (doesn’t seem to be affected by normal URLs).

puts RedCloth.new(’!../…/index.html!’).to_html

Returns:

It trims the any number dots before the first / in relative URL’s. I
kind of depend on this as the code I’m generating is part of a
publishing system that needs to be able to handle relative links so
pages can be distributed offline.

On a side note, congrats Jason on the rewrite! Will it be long before
this new version becomes standard?

Cheers
Jase.

Textile allows for a dot there to end alignment/class/style for the
image. RedCloth 3.0.4 and http://textile.thresholdstate.com/ both
eat the first dot.

RedCloth::VERSION
=> “3.0.4”
RedCloth.new(“!../…/image.jpg!”).to_html
=>

Textile:
!../…/image.jpg!
XHTML:

It appears that both intend to allow that dot only when it’s followed
by a space…

RedCloth 3.0.4:

        (?::#{ HYPERLINK })? # optional href
    /x

classTextile.php:

        (?:\(([^\)]+)\))?  # optional title
        \!                 # closing
        (?::(\S+))?        # optional href
        (?:[\]}]|(?=\s|$)) # lookahead: space or end of string
    /Ux", array(&$this, "fImage"), $text);
}

… but it appears the classTextile.php author missed that that space
would be ignored because of the the x (PCRE_EXTENDED) option (and
RedCloth copied the mistake). Using this seems to fix it:

(?:.\s)? # optional dot-space

Is it better to implement it the “right” (intended) way or in a way
that’s backward-compatible?

I’m going to do it “right” for now and we’ll see how that works out.

http://code.whytheluckystiff.net/redcloth/ticket/49

Excellent work! Many thanks. Can’t believe I missed how easy it was (I
was looking at the URL parsing rules without even stopping to realise
there was a separate set of image parsing rules in the inline Ragel
file).

On a side note, I think I saw something in Trac relating to this, not
sure if it’s the same, but installing from instructions at
http://code.whytheluckystiff.net/redcloth/wiki/SuperRedCloth don’t quite
work (for me at least on Linux)

$ gem install redcloth --source http://code.whytheluckystiff.net

Doesn’t work before it needs to be spelt RedCloth still.

$ svn co http://code.whytheluckystiff.net/svn/redcloth/trunk redcloth
$ cd redcloth
$ rake
$ rake gem
$ gem install pkg/redcloth-3.###.gem

Also doesn’t work because it moans about something in the Rakefile on
line 176. I had to change the platform from WIN32 to CURRENT. Seemed to
work after that, though I dunno if it screws up compiling on WIN32 now
(Not that I care much for Windows personally!)

Anyway, once again thanks for the quick response.
Jase

Excellent work! Many thanks. Can’t believe I missed how easy it was (I
was looking at the URL parsing rules without even stopping to realise
there was a separate set of image parsing rules in the inline Ragel
file).

So glad you found this bug!

On a side note, I think I saw something in Trac relating to this, not
sure if it’s the same, but installing from instructions at
http://code.whytheluckystiff.net/redcloth/wiki/SuperRedCloth don’t
quite
work (for me at least on Linux)

You’re right. Rubygem names are case sensitive. I’ve changed the
wiki page.

Also doesn’t work because it moans about something in the Rakefile on
line 176. I had to change the platform from WIN32 to CURRENT.
Seemed to
work after that, though I dunno if it screws up compiling on WIN32 now
(Not that I care much for Windows personally!)

Yes, this is a problem. I’d been switching it from WIN32 to CURRENT
and _why switched it back a time or two, so I asked him about it and
he needs it set to WIN32 to cross-compile to win32 from his linux
machine. He must be running an older version of rubygems. We need
to figure out how to cross-compile without an error under rubygems >=
1.0.

Jason