Pretty-printing Ruby code to HTML

Hello,

I need to pretty print some Ruby code into HTML.
Any pointers :slight_smile: ?

···

--
Tomasz Wegrzanowski [ http://t-a-w.blogspot.com/ ]

Load it up in vim and export as html (:TOhtml)

martin

···

On 8/10/06, Tomasz Wegrzanowski <tomasz.wegrzanowski@gmail.com> wrote:

Hello,

I need to pretty print some Ruby code into HTML.
Any pointers :slight_smile: ?

vim can do it quite nicely. Not sure how, but I know it can.

Farrel

···

On 10/08/06, Tomasz Wegrzanowski <tomasz.wegrzanowski@gmail.com> wrote:

Hello,

I need to pretty print some Ruby code into HTML.
Any pointers :slight_smile: ?

--
Tomasz Wegrzanowski [ http://t-a-w.blogspot.com/ ]

If you're looking for a code highlighter, try Syntax[1] or Coderay[2].

- Dimitri

[1] http://rubyforge.org/projects/syntax/
[2] http://rubyforge.org/projects/coderay/

···

On 8/10/06, Tomasz Wegrzanowski <tomasz.wegrzanowski@gmail.com> wrote:

Hello,

I need to pretty print some Ruby code into HTML.
Any pointers :slight_smile: ?

Hi All,

I want to embed Ruby in my C++ program. My question relates to thread safety in Ruby. I have an application that is massively threaded. If I create an instance of the ruby interpreter per thread, will Ruby operate in a thread safe manner?

Thanks.

-Brian

···

--------------------
Brian E Campbell
becampbel@hotmail.com

this ruby script uses vim to syntax highlight __any__ source code (fortran, ocaml, idl, etc) to html:

   #!/usr/bin/env ruby
   require 'tempfile'
   $VERBOSE=nil
   STDERR.reopen(Tempfile::new($$)) unless STDIN.tty?

   fin = ARGV.shift
   fout = ARGV.shift

   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!}

-a

···

On Thu, 10 Aug 2006, Tomasz Wegrzanowski wrote:

Hello,

I need to pretty print some Ruby code into HTML.
Any pointers :slight_smile: ?

--
Tomasz Wegrzanowski [ http://t-a-w.blogspot.com/ ]

--
to foster inner awareness, introspection, and reasoning is more efficient than
meditation and prayer.
- h.h. the 14th dali lama

Tomasz Wegrzanowski wrote:

Hello,

I need to pretty print some Ruby code into HTML.
Any pointers :slight_smile: ?

I usually use Jedit and the code2html plugin.

Thanks a lot, coderay is great.

···

On 8/10/06, Dimitri Aivaliotis <aglarond@gmail.com> wrote:

On 8/10/06, Tomasz Wegrzanowski <tomasz.wegrzanowski@gmail.com> wrote:
>
> Hello,
>
> I need to pretty print some Ruby code into HTML.
> Any pointers :slight_smile: ?

If you're looking for a code highlighter, try Syntax[1] or Coderay[2].

[1] http://rubyforge.org/projects/syntax/
[2] http://rubyforge.org/projects/coderay/

--
Tomasz Wegrzanowski [ http://t-a-w.blogspot.com/ ]