visionmedia/jade — pull request #405 by btford (2011-11-17 07:52:09+00:00)
Title: Multiline JavaScript support

I'm a bit new at this Github business, so forgive me if I'm overstepping any boundaries. I'm a big fan of jade, and very grateful for your work. :)

This is a quick and dirty hack to support multiline JavaScript. It preprocesses the input, and rewrites multiline JS to be on a single line before lexing.

````
--
var ob = {
prop: 'val'
}
--
h1 My Awesome Page
````

becomes

````
- var ob = { prop: 'val'}
-#
-#
-#
h1 My Awesome Page
````

The inserted comment lines are there to preserve line numbers errors and warnings normally issued by jade's lex and compile. An exception is thrown if there is no closing "--" with matching indentation. Other than that, line comments ("//") will probably break this, and any indentation within the block is accepted.

I feel a bit guilty mucking up your otherwise nicely written lexer, but hopefully this at least gets the ball rolling on adding multiline support. I'm also not sure if "--" is the "correct" symbol to mark multiline JavaScript. I'd love to hear your thoughts on it.

Thanks!