Extending RedCloth


#1

Hi there, I’d like to extend RedCloth. For example I’d like that
although expressions like !C! Textline are substituted with

Text

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,


#2

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/soks-view.rb

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

Tom


#3

Tom Counsell schrieb:

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

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!("") 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,