Forum: Redcloth Extending RedCloth for CS faculty

Posted by Tibi Turbureanu (Guest)
on 2008-09-09 21:24
(Received via mailing list)
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
Posted by Jason Garber (jgarber)
on 2008-09-12 09:40
(Received via mailing list)
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 Garber
Posted by Tibi Turbureanu (Guest)
on 2008-09-14 22:54
(Received via mailing list)
Hi Jason and thank you for your response,

On Fri, 2008-09-12 at 03:33 -0400, Jason Garber wrote:
> Hi, Tibi.  Sorry I haven't responded in so long.  Things are quite  
> busy at work right now.

Good luck! ;)
> 
> 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? :D

Thanks,
Tibi
Posted by Jase (Guest)
on 2008-09-14 23:27
(Received via mailing list)
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? :D

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.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.