I'm working on a website where I have some text which I am using the RedCloth gem to markdown. basically I need to intercept some text before it gets to the gem, and parse the text with a colour code syntax gem. My regex is very poor (and I don't know if I can do this.) I need to select chucks of text and parse them before RedCloth gets ahold of it.
example text
I need to select (in ruby) the chucks of text that start with ##code(language) and end with #code, I also need to know what is inside of the bracket at the start tag ##code(in-here)
other text.....
##code(ruby)
puts "Hello World"
##code
more text.......
##code(c++)
#include <string>
#include "logger.h"
##code
etc...
any help would be greatly appreciated.
Thanks Phil.