From: James Britt Date: 2005-10-11T01:59:16+09:00 Subject: Re: [ANN] Ruby Code & Style Ara.T.Howard wrote: > On Tue, 11 Oct 2005, James Britt wrote: .. >> >> Indeed, syntax highlighting would be nice. Are there existing Ruby >> apps that will take a source file and generate nice colored HTML? (I >> bet there are; I'm too lazy/busy (blazy?) to look.) > > > vim does this from the command line. this converts a directory full of > ruby > files to syntax highlighted html: > > for f in *.rb;do vim -f +"syn on" +"run! syntax/2html.vim" +"wq" +"q" > $f;done Ah so! See, vim has *everything* ! ... >> *Perhaps*, if anyone wants to take a shot, the markup could be >> pre-processed by a Ruby app that applies syntax coloring only to code >> within
 or  sections.
> 
> 
> it would be trivial to write a ruby app that scanned to the 'indent' class,
> extracted all the next before the matching/closing pre, wrote a tmp file,
> converted it to html, and munged the html file in place with marked up ruby
> code.  let me know if you want me to do it and provide me with a sample 
> html
> file unless you think a file save-as from the site will do.

I'll send you a sample file.  Yours, actually, from RC&S, after the 
markup had been applied.

> 
>> It may be possible to also toss in a marker class attribute value:
>> 
, or 
 so that 
>> different code gets different syntax treatment.
> 
> 
> the thing with vim is that it will determine the automatically from 
> either the
> file extension or the shebang line - no special css needed.

Except that a single ArtimaML file might have source code for multiple 
different languages.

James

-- 

http://www.ruby-doc.org - The Ruby Documentation Site
http://www.rubyxml.com  - News, Articles, and Listings for Ruby & XML
http://www.rubystuff.com - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com  - Playing with Better Toys