Hi, Does anyone know of a html code colorizer for ruby source code? Ideally a typo plugin :) Regards, Jason
At 09:33 2006-07-06, you wrote:>Hi, > >Does anyone know of a html code colorizer for ruby source code? >Ideally a typo plugin :) > >Regards, Jason >_______________________________________________ >Rails mailing list >Rails@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/railsEmacs, ruby.el and htmlize.el /O
On Thu, Jul 06, 2006 at 08:33:12AM +0100, Jason Hyland wrote:
} Hi,
}
} Does anyone know of a html code colorizer for ruby source code?
} Ideally a typo plugin :)
gem install syntax
Then consider the following script:
#######################
#!/usr/bin/env ruby
unless [1,2].include? ARGV.size
$stderr.puts "Usage: #{$PROGRAM_NAME} <syntax> [file]"
exit 1
end
require ''rubygems''
require ''syntax/convertors/html''
convertor = Syntax::Convertors::HTML.for_syntax ARGV.shift
highlighted = convertor.convert(ARGF.read)
highlighted.sub!(/^<pre>/, "<pre
class=\"code\">\n")
puts highlighted
#######################
You''ll need appropriate CSS defined for it. I use the following,
derived
from Vim highlighting:
pre.code span.keyword { color: rgb(165, 42, 42); }
pre.code span.module, pre.code span.class { color: rgb(160, 32, 240); }
pre.code span.punct { color: rgb(106, 90, 205); }
pre.code span.ident { color: rgb(0, 0, 0); }
pre.code span.method { color: rgb(0, 139, 139); }
pre.code span.string { color: rgb(255, 0, 255); }
pre.code span.number { color: rgb(255, 0, 255); }
pre.code span.constant { color: rgb(0, 139, 139); }
This is what I use for my (shameless plug!) blog at
redcorundum.blogspot.com. There you go!
} Regards, Jason
--Greg
On Thu, Jul 06, 2006, Jason Hyland wrote:> Hi, > > Does anyone know of a html code colorizer for ruby source code? > Ideally a typo plugin :)If you have the syntax gem installed, Typo already does this: <typo:code lang="ruby"> some.ruby {|code| here} </typo> Go to your Admin page''s Filters tab to learn more. You''ll need to modify the stylesheet as mentioned elsewhere, but I believe the default theme has it already. Ben
On Jul 6, 2006, at 8:15 AM, Ben Bleything wrote:> On Thu, Jul 06, 2006, Jason Hyland wrote: >> Hi, >> >> Does anyone know of a html code colorizer for ruby source code? >> Ideally a typo plugin :) > > If you have the syntax gem installed, Typo already does this: > > <typo:code lang="ruby"> > some.ruby {|code| here} > </typo> > > Go to your Admin page''s Filters tab to learn more. > > You''ll need to modify the stylesheet as mentioned elsewhere, but I > believe the default theme has it already. > > BenI have found that CodeRay[1] is faster and more flexibile then the syntax gem. Cheers- -Ezra [1] http://coderay.rubychan.de/