Colored syntax output


#1

Hello!

Maybe someone here knows how to do this:

I have some Ruby code, and I need it in a syntax colored HTML output
format.

Is there any easy way to do this, maybe the “ruby” binary can do this?

Thanks alot,
Rob


#2

On Jun 10, 2006, at 2:48 PM, Robert MannI wrote:

Hello!

Maybe someone here knows how to do this:

I have some Ruby code, and I need it in a syntax colored HTML
output format.

Is there any easy way to do this, maybe the “ruby” binary can do this?

enscript --color --language=html -Eruby --output=blah.html blah.rb

you may need to add knowledge of ruby syntax to the appropriate
enscript file. i remember this involved finding the ruby-related
stuff with google and pasting it into a file. you may also need to
install enscript. i didn’t. i’m on OS X.

– Elliot T.


#3

On 10-Jun-06, at 5:48 PM, Robert MannI wrote:

Hello!

Maybe someone here knows how to do this:

I have some Ruby code, and I need it in a syntax colored HTML
output format.

Is there any easy way to do this, maybe the “ruby” binary can do this?

If you have vim then this:

vim -f +“syn on” +“run! syntax/2html.vim” +“wq” +“q” file.rb

should generate file.rb.html

Hope this helps,

Mike

Mike S. removed_email_address@domain.invalid
http://www.stok.ca/~mike/

The “`Stok’ disclaimers” apply.


#4

On Jun 10, 2006, at 2:48 PM, Robert MannI wrote:

Thanks alot,
Rob

Hey Robert-

There are two gems that are available that will produce colorized

html out of ruby code.

http://coderay.rubychan.de/
gem install coderay

AND

http://syntax.rubyforge.org/
gem install syntax

Cheers-
-Ezra


#5

Thanks alot for all the tips :slight_smile:


#6

I have a blog entry on how I did this…

http://blog.wolfman.com/articles/2006/05/26/howto-format-ruby-code-for-blogs


#7

Robert MannI wrote:

Hello!

Maybe someone here knows how to do this:

I have some Ruby code, and I need it in a syntax colored HTML output
format.

SciTE is able to export the current file into RTF, HTML, XML and some
others.

Stefan