Embracing Ruby on Rails
There has been so much hype surrounding Ruby on Rails. Even the mailing list for my beloved CGI:Application framework was being littered with posts comparing the two or about how to make thinks more railsesque. But on the other hand, I had spent so much time coding my previous site engine in Perl and perfecting it that I didn’t know if it would be worth the effort to learn a new platform, a new language with a different set of idioms, and rewrite working code. Well in about two months (my first commit was April 6th), I have a working site that is nearly feature comparable (and in some cases far surpasses) with my previous design. Rails really is a very powerful web development platform.
Extending RedCloth
RedCloth is Ruby’s Textile module. Textile is a lightweight markup language originally developed by Dean Allen that allows a user to create well-formed styled XHTML. This site employes the RedCloth Textile module through the acts_as_textiled plugin. The nice thing about RedCloth is it is faily easy to extend the markup which it recognies. In this tutorial, I am going to show you how to render [latex]\LaTeX{}[/latex] in your site by extending RedCloth.
Syntax Highlighting with RedCloth
After I implemented LaTeX rendering into my views, I was quite satisfied with how it came out. LaTeX can now be effortless inserted into a field that is textile enabled with very good results. But then I began to look at the code snippits and I realized how ugly they look when compared to the rest of the site. I did a quick web search for ways to incorporate syntax highlighting in Rails applications, but I wasn’t really satisfied with what I found. Then the solution smacked me in the face. Just extend RedCloth!
