Skip to content

Instantly share code, notes, and snippets.

@ROFISH
Forked from mislav/gist:17371
Created February 23, 2012 01:10
Show Gist options
  • Save ROFISH/1888936 to your computer and use it in GitHub Desktop.
Save ROFISH/1888936 to your computer and use it in GitHub Desktop.
haml2erb
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
def parse_tag(line)
out = super
out[2][:old].gsub!(/\#\{(.*?)\}/) { |match| "<%= #{$1} %>" } if out[2][:old]
out
end
end
s='.overlay.centercenter
.lolflexbox
%h3=t("forum.topic.deleted_notice")
%ul.util
%li
%a.button{:href=>"#",:onclick=>"$(\"#post#{message.id} .overlay\").fadeOut();return false;"}=t("forum.topic.show_deleted_post")'
ErbEngine.new(s,:escape_attrs=>false).to_html
<div class='overlay centercenter'>
<div class='lolflexbox'>
<h3> <%= t("forum.topic.deleted_notice") %>
</h3>
<ul class='util'>
<li>
<a class='button' href='#' onclick='$("#post<%= message.id %> .overlay").fadeOut();return false;'> <%= t("forum.topic.show_deleted_post") %>
</a>
</li>
</ul>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment