[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

markdown, textile, etc

Belorion

6/19/2005 7:39:00 PM

I've been trying to use RedCloth in a rails app. According to the
documentatoin at
http://redcloth.rubyforge.org/rdoc/classes/RedCloth.ht..., if I
supply [:filter_html] as an option when I create a new RedCloth
instance, all html not created by RedCloth is escaped. This doesn't
appear to be the case for me, though...

%> ruby -e "require 'rubygems'; require_gem 'RedCloth', '~> 3.0.3'; r=
RedCloth.new( \"<b>foo</b> *bar*\", [:filter_html] ); puts r.to_html "

Gives:

<p><b>foo</b> <strong>bar</strong></p>

Clearly, the html is not being espcaped, which is contrary to the
documenation, and not what I expected to happen. Has anyone been able
to get this to work? Or, alternatively, does anyone know of a library
that will provide similar functionality? Thanks.

Matt


1 Answer

Ryan Leavengood

6/19/2005 8:46:00 PM

0

Belorion wrote:
> Clearly, the html is not being espcaped, which is contrary to the
> documenation, and not what I expected to happen. Has anyone been able
> to get this to work? Or, alternatively, does anyone know of a library
> that will provide similar functionality? Thanks.

I have a similar requirement in a Rails app I'm writing, and I've just
confirmed this on RedCloth 3.0.3 (which is the same version you have.)
This also presents problems for me, hmmmm.

What it does do is this:

irb(main):019:0> r = RedCloth.new("<img src='foo.jpg'/> *strong*",
[:filter_html])
=> "<img src='foo.jpg'/> *strong*"
irb(main):020:0> r.to_html
=> "<p><img> <strong>strong</strong></p>"

I'm not sure what point it is to break the HTML and even make it
non-XHTML compliant.

Ryan