Today, I ported the Perl library SmartyPants to Ruby. SmartyPants calls itself an “web publishing utility that translates plain ASCII punctuation characters into “smart” typographic punctuation HTML entities.” By the way, it’s written by the author of Markdown (which I use for a long time now), John Gruber.
Porting was quite easy, as I had a Perl and a Python implementation available (playing “Rosetta Stone” is fun :-)), I only got stuck at some Perl-specific Regexp stuff, but that was worked around easily.
Before RubyPants, I used some very primitive regexen to make em-dashs (--- gets —) and and ellipses (... gets …). However, I never got around converting quotes ("foo" gets “foo”) because that is quite difficult. Fortunately, SmartyPants handles most cases, and the very special cases can easily get corrected manually.
Grab RubyPants 0.1 while it’s still hot!: rubypants.rb (Proper release comming soon)
NP: Mark Knopfler—Boom Like That