Extending RedCloth for CS faculty

Hello everyone,

I want to extend RedCloth so my Faculty may use Instiki with the
modified RedCloth plugin, for lab exercises.

I thought I might use the RedCloth parser and identify new keywords like
#!show_sol, #!hide_sol, #solution to permit administrators (professors,
assistants) to hide the solutions for the lab exercises when students
have to solve them and after that to show the solutions.

Using a wiki for labs has lots of advantages and this is why we decided
to extend an existent syntax (textile).

Can you please give me some tips for this task?

  • Is it the right approach extending RedCloth?
  • I browsed the source but couldn’t find the file I should alter (I am
    Ruby newbie).
  • How do you find the keywords?

Example:

#!hide_sol

Use the `grep’ command to output the lines containing smth in file.txt

#!solution{
cat file.txt | grep “smth”
}

and after the lab:

#!show_sol

Use the `grep’ command to output the lines containing smth in file.txt

#!solution{
cat file.txt | grep “smth”
}

Thank you in advance,
Tibi

Hi, Tibi. Sorry I haven’t responded in so long. Things are quite
busy at work right now.

I suggest you don’t extend RedCloth but rather that you filter that
text before passing it to RedCloth. Just a couple regular
expressions in Ruby could handle it much better than RedCloth and at
very low expense.

Best wishes!
Jason G.

Hi Jason and thank you for your response,

On Fri, 2008-09-12 at 03:33 -0400, Jason G. wrote:

Hi, Tibi. Sorry I haven’t responded in so long. Things are quite
busy at work right now.

Good luck! :wink:

I suggest you don’t extend RedCloth but rather that you filter that
text before passing it to RedCloth. Just a couple regular
expressions in Ruby could handle it much better than RedCloth and at
very low expense.

I tried but can’t find where in the source code is the part Instiki
sends the wiki page to RedCloth parser. Can you give me some tips? :smiley:

Thanks,
Tibi

On Sun, 2008-09-14 at 23:51 +0300, Tibi Turbureanu wrote:

expressions in Ruby could handle it much better than RedCloth and at
very low expense.

If you did go down the route of extending Redcloth, you can look at the
tests / reimplementing the formatters. I did have a page that explained
how to do this, but damn server is down (friend’s server, I planned to
move away from it tbh).

I tried but can’t find where in the source code is the part Instiki
sends the wiki page to RedCloth parser. Can you give me some tips? :smiley:

grep is your friend here. From the Instiki source, I suggest:

grep -rn ‘Redcloth’ .

If there is .svn files about, you can make this:

grep -rn ‘Redcloth’ . | svn -v svn

see as the pesky SVN files always get in the way.