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?
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?
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.
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.
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).
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).
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.