From: "Jean-François Trân" Date: 2008-10-19T01:11:54+09:00 Subject: Re: Low level syntax highlighting tools? 2008/10/18 Gregory Brown : > I'll confess I didn't research this deeply, in hopes that someone > knows of a library and can point me right at it. > > Are there any syntax gems out there that'll spit back simple strings > and color values, > something like: > > [["def foo\n", "ccffcc"], [" bar()\n", "ffffff" ], ["end", "ccffcc"]] I guess no, but if you're using a syntax-colorizing, I think the thing to do is using the scanner/tokenizer part, that will yield you tokens for a specified language, and then you just have to create your own class of Encoder/Converter that will consume tokens and generate what you need, here an array like you want. It should be easy, for example, with CodeRay [1] : write your encoder, and don't use the html encoder. > If such a tool exists, I can rejoice, because it'd allow me to build > an awsum Prawn based presentation builder. Very interesting. I was also thinking of using Prawn to generate slides. -- Jean-François. [1] http://coderay.rubychan.de -- Les 50 ans du Lisp : http://www.lisp50.org http://twitter.com/underflow_