All Hallow's Eve

Thursday, October 05

Check out this pretty syntax highlighting! James Wilford was kind enough to contribute it to Scribbish, and I made the colors match TextMate’s All Hallow’s Eve theme.

Here is some random code (from HAML, actually) to show it off:


require File.dirname(__FILE__) + '/engine'

module Haml
  class Template
    def initialize(view)
      @view = view
    end

    def render(template, local_assigns={})
      assigns = @view.assigns.dup

      @view.instance_eval do
        assigns.each do |key,val|
          instance_variable_set "@#{key}", val
        end

        local_assigns.each do |key,val|
          class << self; self; end.send(:define_method, key) { val }
        end
      end

      Haml::Engine.new(template, :scope_object => @view).to_html
    end
  end
end

Syntax highlighting is available in the Scribbish svn repository. Instructions for checking out the code are on the download page.

Comments

Leave a response