Pretty-printing Ruby code to HTML

Hello,

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

On 8/10/06, Tomasz W. [email protected] wrote:

Hello,

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

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

martin

On 10/08/06, Tomasz W. [email protected] wrote:

Hello,

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


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

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

Farrel

On 8/10/06, Tomasz W. [email protected] 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].

  • Dimitri

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

On Thu, 10 Aug 2006, Tomasz W. wrote:

Hello,

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


Tomasz W. [ http://t-a-w.blogspot.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

Tomasz W. wrote:

Hello,

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

I usually use Jedit and the code2html plugin.

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

On 8/10/06, Dimitri A. [email protected] wrote:

[2] http://rubyforge.org/projects/coderay/
Thanks a lot, coderay is great.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs