Skip to content

Instantly share code, notes, and snippets.

@iMagesh
Forked from fxposter/gist:1391475
Created September 1, 2014 08:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iMagesh/9ae481a75425234f1f0b to your computer and use it in GitHub Desktop.
Save iMagesh/9ae481a75425234f1f0b to your computer and use it in GitHub Desktop.
require 'haml'
class ErbEngine < Haml::Engine
def push_script(text, preserve_script, in_tag = false, preserve_tag = false,
escape_html = false, nuke_inner_whitespace = false)
push_text "<%= #{text.strip} %>"
end
def push_silent(text, can_suppress = false)
push_text "<% #{text.strip} %>"
end
end
def haml_to_erb(haml)
ErbEngine.new(haml, :attr_wrapper => '"').render
end
# puts haml_to_erb(File.read('app/views/features/_feature.html.haml'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment