如何在没有抱怨的情况下将代码粘贴到haml中?

时间:2012-05-10 00:13:53

标签: haml

我有以下代码,并且讨厌在我希望它保持原样时将代码缩进到同一行?

我必须缩进它:

.content.first
Thank you for taking our Survey, hope you had fun!!!
<!-- Begin MailChimp Signup Form -->
<link href="http://cdn-images.mailchimp.com/embedcode/slim-081711.css" rel="stylesheet" type="text/css">
<div id="mc_embed_signup" style="text-align:center">
<form onsubmit="_kmq.push(['record', 'sign up for our newsletter'])" action="http://socialcrunch.us5.list-manage.com/subscribe/post?u=755f44e55d468b9568a7ec9de&amp;id=7f27e118c4" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank">
%label{:style=>"text-align:center"}
  %br
  Like spandex wearing gym freaks, SocialCrunch is in training.
  %br
  %br
  You have been one of the first people to take part in a test which will form the basis of our website.
  %br
  %br
  Input your email below to learn more about SocialCrunch and our launch later this summer!
  %br
  %br
  Thank you for taking part, we hope you had fun.
<input style="margin-left: 21%;text-align:center" type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required>
<div class="clear"><input style="margin-left:33%" type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div>
</form>
</div>

我可以通过一些忽略我的缩进而不会抱怨的过滤器来运行吗?

1 个答案:

答案 0 :(得分:1)

HAML语法是缩进敏感的,并且没有“过滤器”会忽略您的缩进。 HAML使用缩进将您的代码正确转换为相应的HTML代码块。

如果您厌倦了手动缩进haml代码并使用emacs作为编辑器,那么您可以按照此处的说明进行操作

http://emacswiki.org/emacs/HamlMode

并永久解决您的问题