![](/img/trans.png)
[英]Vim how to add a hash tag to an eruby (erb) file in order to comment out a line
[英]How to comment out a line in HAMLC comment
想知道如何在HAMLC中注釋掉一行。 我試過了
# this is commented out
但這是行不通的。 它創建一個<div> this is commented out </div>
在HAMLC上找不到很多資源。
知道如何注釋多行也將不勝感激。
這是從Haml文檔中獲取評論的 :
評論
Haml支持兩種注釋:在HTML輸出中顯示的注釋和不顯示的注釋。
HTML注釋:/
當正斜杠字符放在行的開頭時,它將其后的所有文本包裝在HTML注釋中。 例如:
%peanutbutterjelly
/ This is the peanutbutterjelly element
I like sandwiches!
編譯為:
<peanutbutterjelly>
<!-- This is the peanutbutterjelly element -->
I like sandwiches!
</peanutbutterjelly>
正斜杠還可以包裝代碼的縮進部分。 例如:
/
%p This doesn't render...
%div
%h1 Because it's commented out!
編譯為:
<!--
<p>This doesn't render...</p>
<div>
<h1>Because it's commented out!</h1>
</div>
-->
條件注釋:/ []
您還可以通過將條件放在/后面的方括號中來使用Internet Explorer條件注釋。 例如:
/[if IE]
%a{ :href => 'http://www.mozilla.com/en-US/firefox/' }
%h1 Get Firefox
編譯為:
<!--[if IE]>
<a href='http://www.mozilla.com/en-US/firefox/'>
<h1>Get Firefox</h1>
</a>
<![endif]-->
哈姆爾評論:-#
連字符后緊跟井號表示無聲評論。 緊隨其后的任何文本都不會顯示在結果文檔中。
例如:
%p foo
-# This is a comment
%p bar
編譯為:
<p>foo</p>
<p>bar</p>
您還可以將文本嵌套在無聲注釋下方。 這些文本均不會呈現。 例如:
%p foo
-#
This won't be displayed
Nor will this
Nor will this.
%p bar
編譯為:
<p>foo</p>
<p>bar</p>
這些是其他參考:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.