Forum: Ruby Colored syntax output

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Robert MannI (Guest)
on 2006-06-11 01:51
(Received via mailing list)
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
Elliot T. (Guest)
on 2006-06-11 02:18
(Received via mailing list)
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.
http://www.curi.us/blog/
Mike S. (Guest)
on 2006-06-11 02:28
(Received via mailing list)
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.
Ezra Z. (Guest)
on 2006-06-11 02:34
(Received via mailing list)
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
Jim M. (Guest)
on 2006-06-11 11:28
(Received via mailing list)
I have a blog entry on how I did this...

http://blog.wolfman.com/articles/2006/05/26/howto-...
Robert MannI (Guest)
on 2006-06-11 13:33
(Received via mailing list)
Thanks alot for all the tips :)
Stefan M. (Guest)
on 2006-06-11 22:03
(Received via mailing list)
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
This topic is locked and can not be replied to.