Forum: Ruby Extending RedCloth

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Daniel Völkerts (Guest)
on 2006-05-22 20:50
(Received via mailing list)
Hi there, I'd like to extend RedCloth. For example I'd like that
although expressions like _!C! Textline_ are substituted with

<div id="cave">Text</div>

What is the best/ruby way to achieve this? My ideas was:

a. write a extension for RedCloth and register to the RC base (is this
possible?)

b. Extending the RedCloth class (aka patching)

Any ideas appreciated,
Tom Counsell (Guest)
on 2006-05-22 21:41
Hi Daniel

Daniel Völkerts wrote:
> Hi there, I'd like to extend RedCloth.

> b. Extending the RedCloth class (aka patching)

No idea if it is best, but that is what I did.  Take a look halfway
down:

http://www.counsell.org/darcs/soks-development/lib...

The tricky bit was adjusting the order that things were done in the
RULES array so that the different changes didn't clash.

Tom
Daniel Völkerts (Guest)
on 2006-05-22 21:50
(Received via mailing list)
Tom Counsell schrieb:


> http://www.counsell.org/darcs/soks-development/lib...
>
> The tricky bit was adjusting the order that things were done in the
> RULES array so that the different changes didn't clash.

Thanks a lot. I would be helpful if there are any #register(..) methods
were I can hook in my extensions and which handle the rule thing
correctly. But for my needs I cascade the call, e.g. following the
example on the RedCloth side:

s = RedCloth.new "*simple* test with !C! Attention"

followed by a chain of s.gsub!("<regexp goes here>") goals. So I'm not
threating the RedCoth thing and it is aware of further RedCloth updates
(as I don't any rules internally).

Thanks for your fast help,
This topic is locked and can not be replied to.