Multiline template strings that don't break indentation

Owen Densmore owen at backspaces.net
Wed Sep 17 19:44:14 PDT 2014


I'm always surprised we keep forgetting coffeescrip,
http://coffeescript.org/t:

     Multiline strings are allowed in CoffeeScript.
     Lines are joined by a single space unless they end with a backslash.
     Indentation is ignored.

mobyDick = "Call me Ishmael. Some years ago -- never mind how long
precisely -- having little or no money in my purse, and nothing particular
to interest me on shore, I thought I would sail about a little and see the
watery part of the world..."


and:

     Block strings can be used to hold formatted or indentation-sensitive
text
     (or, if you just don't feel like escaping quotes and apostrophes).
     The indentation level that begins the block is maintained throughout,
     so you can keep it all aligned with the body of your code.

html = """ <strong> cup of coffeescript </strong> """


 -- Owen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140917/32524a3e/attachment.html>


More information about the es-discuss mailing list