comments
Comments
Template::HAML supports three forms of comments: HTML comments, conditional comments, and silent comments.
HTML comments ā /
A line beginning with / is rendered as an HTML comment.
Single-line form:
/ Hello<!-- Hello -->If the / line has children indented underneath, they are rendered inside the comment block:
/
%p hi<!--
<p>hi</p>
-->Conditional comments ā /[expr]
Use /[expr] to emit a conditional comment. The bracketed text becomes the condition; surrounding whitespace is stripped.
Inline form:
/[if IE] text<!--[if IE]>text<![endif]-->Block form:
/[if IE]
%p ie only<!--[if IE]>
<p>ie only</p>
<![endif]-->Negated:
/[if !IE] text<!--[if !IE]>text<![endif]-->Revealed conditional comments ā /![expr]
Prefix the bracket with ! to emit a downlevel-revealed conditional comment. Browsers that don't honor the condition see the wrapped content as plain markup:
/![if !IE] text<!--[if !IE]><!-->text<!--<![endif]-->Silent comments ā -#
A line beginning with -# is suppressed entirely. Any indented body ā including any number of blank lines ā is treated as opaque text and produces no output:
%p hi
-# notes:
arbitrary text $^&* not parsed as HAML
!!! also opaque
%p bye<p>hi</p>
<p>bye</p>Because the body is opaque, you can drop in non-HAML content (e.g. design notes, stale code, scratch markup) without provoking parse errors.