Syntax highlighting code with Ruby and Ultraviolet

This site uses [Ultraviolet](http://ultraviolet.rubyforge.org/) for syntax highlighting. Ultraviolet supports 50 languages and 20 themes, so it's sometimes difficult to pick the best theme, which is why I created the following code snippet that renders the code in all available themes and creates an HTML page displaying them all: ```ruby require 'uv' language = ARGV[1] input_file = ARGV[0] line_numbers = true output_format = "xhtml" input = File.read(input_file) # Render input using all available themes syntax_highlighted_code = "" Uv.themes.each do |theme| syntax_highlighted_code << "

#{theme}

" syntax_highlighted_code << Uv.parse( input, output_format, language, line_numbers, theme) end # Template for output file page_template = < test #{Uv.themes.map{|theme| %Q(\n)}} #{syntax_highlighted_code} HTML_DOC # Write highlighted text to output File.open("output.html", "w") do |file| file << page_template end ``` Yes, using ERB templates would be better but interpolated strings work just fine... Save the code in highlight.rb and run it as follows: ```ruby highlight.rb ruby input_file.rb ```