From: ara.t.howard@... Date: 2006-05-03T01:52:19+09:00 Subject: Re: Syntax highlighting library On Tue, 2 May 2006, Dimitri Aivaliotis wrote: > On 5/2/06, Victor Shepelev wrote: >> >> >> Does some good subj exists? >> > > Try Syntax or > CodeRay > . > > - Dimitri this simple script will convert any src file, including fortran, c++, java, etc, to html: harp:~ > cat a.rb #!/usr/bin/env ruby require 'tempfile' $VERBOSE=nil STDERR.reopen(Tempfile::new($$)) unless STDIN.tty? fin, fout, _ = ARGV fin = ((fin.nil? or fin == '-') ? STDIN : open(fin)) fout = ((fout.nil? or fout == '-') ? STDOUT : open(fout,'w+')) ts = Tempfile::new($$), Tempfile::new($$) ts[0].write fin.read ts.each{|t| t.close} command = %Q( vim -f +'syn on' +'set filetype=ruby' +'set background=light' +'run! syntax/2html.vim' +'w! #{ ts[1].path }' +'qa!' - < #{ ts[0].path } > /dev/null 2>&1 ) system command ts.each{|t| t.open; t.rewind} fout.write(ts[1].read) ts.each{|t| t.close!} the 'set filetype=ruby' functions only as a default. for instance this ruby a.rb src.c src.html does the right thing. regards. -a -- be kind whenever possible... it is always possible. - h.h. the 14th dali lama