Ruby library for Objective-C syntax highlighing
I have a blog built with Ruby, but I frequently blog about Objective-C topics.
I thus need a Ruby library that can take Objective-C source code strings and produce syn开发者_开发知识库tax-highlighted HTML output.
For Ruby source strings, I am happily using the syntax gem - http://syntax.rubyforge.org/ - but I can't find an Objective-C tokenizer for this library.
Is there an open source tokenizer available, or another library which can do this in Ruby?
If all else fails, all I've found is a PHP library (GeSHi) which claims to have Obj-C support, and I'll have to install PHP on my host, write a janky shell exec based invocation of it. I would love to avoid this. Thanks!
Well, you can just use a command line tool to do this and the best possible solution is surely Pygments, and if you're running on a Linux hosting you probably have Python installed already.
Just call it from the command line and store the output somewhere.
A little digging on Google led me to this gem, Highlight, which supports Objective-C. There are a few other Ruby gems listed here.
精彩评论