Skip to content

Instantly share code, notes, and snippets.

@schorsch
Created April 5, 2009 09:03
Show Gist options
  • Save schorsch/90413 to your computer and use it in GitHub Desktop.
Save schorsch/90413 to your computer and use it in GitHub Desktop.
# From http://blog.teamschnitzel.com/2007/05/14/haml-parsing-for-ruby-gettext
require 'gettext/tools/rgettext'
module HamlParser
module_function
def target?(file)
File.extname(file) == ".haml"
end
def parse(file, ary = [])
haml = Haml::Engine.new(IO.readlines(file).join)
code = haml.precompiled.split(/$/)
RubyParser.parse_lines(file, code, ary)
end
end
GetText::RGetText.add_parser(HamlParser)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment