Hi,
Does anyone know of a html code colorizer for ruby source code?
Ideally a typo plugin
Regards, Jason
Hi,
Does anyone know of a html code colorizer for ruby source code?
Ideally a typo plugin
Regards, Jason
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}
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 B. wrote:
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
I have found that CodeRay[1] is faster and more flexibile then the
syntax gem.
Cheers-
-Ezra
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} [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 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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs