Skip to content

Instantly share code, notes, and snippets.

@aseemk
Created May 11, 2011 09:43
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 aseemk/966202 to your computer and use it in GitHub Desktop.
Save aseemk/966202 to your computer and use it in GitHub Desktop.
Eco multi-line blocks and comments.
<h1>Multi-Line Blocks</h1>
<p>
It would be great to support multi-line blocks.
Here are some use cases:
</p>
<%
# Documentation via multiple lines of single-line comments.
# Like so.
%>
<%
# view logic that belongs together in a group.
# e.g. constants:
FOO = 'foo'
BAR = 'bar'
BAZ = 'baz'
%>
<%
# helper functions that really want to be multiple lines,
# e.g. for readability or inline code comments:
# make phrase suitable for use as id/class attribute
idify = (phrase) ->
phrase.toLowerCase()
.replace(/\s/g, '-') # replace whitespace w/ dashes
.replace(/[',?]/g, '') # strip punctuation
%>
<%
# or to comment out an entire block of HTML.
# this is better than <!-- ... --> both because it takes precedence
# but also because the commented HTML won't get sent to the client,
# which is good for perf but can also be useful for security,
# e.g. to put a FIXME for an XSS vulnerability. ;)
%>
<% ###
<p>
I don't want this HTML to show up in my output.
</p>
### %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment