Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'integration'

  • Loading branch information...
commit a92521b11fd65a7498905df073a66daab72e2f10 2 parents 2f0a497 + 7b1fd7c
@tj tj authored
View
3  .gitmodules
@@ -16,3 +16,6 @@
[submodule "benchmarks/haml"]
path = benchmarks/haml
url = git://github.com/visionmedia/haml.js.git
+[submodule "support/coffee-script"]
+ path = support/coffee-script
+ url = http://github.com/jashkenas/coffee-script.git
View
1  Makefile
@@ -4,6 +4,7 @@ TESTS = test/*.js
test:
@./support/expresso/bin/expresso \
-I lib \
+ -I support/coffee-script/lib \
-I support/markdown/lib \
-I support/sass/lib \
$(TESTS)
View
1  Readme.md
@@ -25,6 +25,7 @@
- :markdown must have [markdown-js](http://github.com/evilstreak/markdown-js) installed or [node-discount](http://github.com/visionmedia/node-discount)
- :cdata
- :javascript
+ - :coffeescript must have [coffee-script](http://jashkenas.github.com/coffee-script/) installed
- [TextMate Bundle](http://github.com/miksago/jade-tmbundle)
- [Screencasts](http://tjholowaychuk.com/post/1004255394/jade-screencast-template-engine-for-nodejs)
View
10 lib/filters.js
@@ -56,5 +56,15 @@ module.exports = {
return (md.toHTML
? md.toHTML(str)
: md.parse(str)).replace(/\n/g, '\\n').replace(/'/g,''');
+ },
+
+ /**
+ * Transform coffeescript to javascript.
+ */
+
+ coffeescript: function(str){
+ str = str.replace(/\\n/g, '\n');
+ var js = require('coffee-script').compile(str).replace(/\n/g, '\\n');
+ return '<script type="text/javascript">\\n' + js + '</script>';
}
};
1  support/coffee-script
@@ -0,0 +1 @@
+Subproject commit 502d444ebd6c0589a14cc20e951d5b34a30d46c7
View
15 test/filters.test.js
@@ -90,6 +90,21 @@ module.exports = {
'<style>.class {\n width: 20px;\n}\n</style>',
render(':less\n | .class { width: 10px * 2 }'));
},
+
+ 'test :coffeescript filter': function(assert){
+ var js = [
+ '(function() {',
+ ' var square;',
+ ' square = function(x) {',
+ ' return x * x;',
+ ' };',
+ '}).call(this);'
+ ].join('\n');
+
+ assert.equal(
+ '<script type="text/javascript">\n' + js + '\n</script>',
+ render(':coffeescript\n | square = (x) ->\n | x * x'));
+ },
'test parse tree': function(assert){
var str = [
Please sign in to comment.
Something went wrong with that request. Please try again.