adding documentation for --stdio

This commit is contained in:
Jeremy Ashkenas 2010-02-24 18:27:10 -05:00
parent 9f8710b631
commit b26e577244
36 changed files with 55 additions and 39 deletions

View File

@ -1,7 +1,7 @@
<% <%
require 'uv' require 'uv'
def code_for(file, executable=false) def code_for(file, executable=false)
@stripper ||= /(\A\(function\(\)\{\n|\}\)\(\);\Z|^ )/ @stripper ||= /(\A\(function\(\)\{\n|\}\)\(\);\n*\Z|^ )/
return '' unless File.exists?("documentation/js/#{file}.js") return '' unless File.exists?("documentation/js/#{file}.js")
cs = File.read("documentation/coffee/#{file}.coffee") cs = File.read("documentation/coffee/#{file}.coffee")
js = File.read("documentation/js/#{file}.js").gsub(@stripper, '') js = File.read("documentation/js/#{file}.js").gsub(@stripper, '')
@ -138,7 +138,7 @@ alert reverse '!tpircseeffoC'</textarea>
</h2> </h2>
<p> <p>
The CoffeeScript compiler is written in pure CoffeeScript, using a The CoffeeScript compiler is written in pure CoffeeScript, using a
<a href="http://github.com/jashkenas/coffee-script/blob/master/src/grammar.coffee">small DSL</a> <a href="http://github.com/jashkenas/coffee-script/blob/master/src/grammar.coffee">small DSL</a>
on top of the <a href="http://github.com/zaach/jison">Jison parser generator</a>, and is available on top of the <a href="http://github.com/zaach/jison">Jison parser generator</a>, and is available
as a <a href="http://nodejs.org/">Node.js</a> utility. The core compiler however, as a <a href="http://nodejs.org/">Node.js</a> utility. The core compiler however,
@ -214,6 +214,14 @@ sudo bin/cake install</pre>
conjunction with <tt>--watch</tt>) conjunction with <tt>--watch</tt>)
</td> </td>
</tr> </tr>
<tr>
<td><code>-s, --stdio</code></td>
<td>
Pipe in CoffeeScript to STDIN and get back JavaScript over STDOUT.
Good for use with processes written in other languages. An example:<br />
<tt>cat src/cake.coffee | coffee -s</tt>
</td>
</tr>
<tr> <tr>
<td><code>-e, --eval</code></td> <td><code>-e, --eval</code></td>
<td> <td>
@ -744,7 +752,7 @@ coffee --print app/scripts/*.coffee > concatenation.js</pre>
<span id="change_log" class="bookmark"></span> <span id="change_log" class="bookmark"></span>
Change Log Change Log
</h2> </h2>
<p> <p>
<b class="header" style="margin-top: 20px;">0.5.1</b> <b class="header" style="margin-top: 20px;">0.5.1</b>
Improvements to null soaking with the existential operator, including Improvements to null soaking with the existential operator, including

View File

@ -11,4 +11,4 @@
} }
car.speed < speed_limit ? accelerate() : null; car.speed < speed_limit ? accelerate() : null;
print("My name is " + this.name); print("My name is " + this.name);
})(); })();

View File

@ -5,4 +5,4 @@
return alert(arguments.reverse()); return alert(arguments.reverse());
}; };
backwards("stairway", "to", "heaven"); backwards("stairway", "to", "heaven");
})(); })();

View File

@ -23,4 +23,4 @@
} }
} }
} }
})(); })();

View File

@ -2,4 +2,4 @@
var difficulty, greeting; var difficulty, greeting;
greeting = "Hello CoffeeScript"; greeting = "Hello CoffeeScript";
difficulty = 0.5; difficulty = 0.5;
})(); })();

View File

@ -11,4 +11,4 @@
} }
return _a; return _a;
}); });
})(); })();

View File

@ -2,4 +2,4 @@
var cholesterol, healthy; var cholesterol, healthy;
cholesterol = 127; cholesterol = 127;
healthy = (200 > cholesterol) && (cholesterol > 60); healthy = (200 > cholesterol) && (cholesterol > 60);
})(); })();

View File

@ -9,4 +9,4 @@
} }
date = friday ? sue : jill; date = friday ? sue : jill;
expensive = expensive || do_the_math(); expensive = expensive || do_the_math();
})(); })();

View File

@ -3,4 +3,4 @@
hi = function() { hi = function() {
return [document.title, "Hello JavaScript"].join(": "); return [document.title, "Hello JavaScript"].join(": ");
}; };
})(); })();

View File

@ -4,4 +4,4 @@
solipsism = true; solipsism = true;
} }
speed = (typeof speed !== "undefined" && speed !== null) ? speed : 140; speed = (typeof speed !== "undefined" && speed !== null) ? speed : 140;
})(); })();

View File

@ -10,4 +10,4 @@
} }
}; };
eldest = 24 > 21 ? "Liz" : "Ike"; eldest = 24 > 21 ? "Liz" : "Ike";
})(); })();

View File

@ -1,4 +1,4 @@
(function(){ (function(){
var one, six, three, two; var one, six, three, two;
six = ((one = 1)) + ((two = 2)) + ((three = 3)); six = ((one = 1)) + ((two = 2)) + ((three = 3));
})(); })();

View File

@ -9,4 +9,4 @@
}} }}
return _a; return _a;
}).call(this).slice(0, 10); }).call(this).slice(0, 10);
})(); })();

View File

@ -6,4 +6,4 @@
return "And the error is ... " + error; return "And the error is ... " + error;
} }
}).call(this)); }).call(this));
})(); })();

View File

@ -12,4 +12,4 @@
}); });
})(this)); })(this));
}; };
})(); })();

View File

@ -6,4 +6,4 @@
cube = function cube(x) { cube = function cube(x) {
return square(x) * x; return square(x) * x;
}; };
})(); })();

View File

@ -1,4 +1,4 @@
(function(){ (function(){
var html; var html;
html = "<strong>\n cup of coffeescript\n</strong>"; html = "<strong>\n cup of coffeescript\n</strong>";
})(); })();

View File

@ -8,4 +8,4 @@
city = _a[0]; city = _a[0];
temp = _a[1]; temp = _a[1];
forecast = _a[2]; forecast = _a[2];
})(); })();

View File

@ -14,4 +14,4 @@
}} }}
return _a; return _a;
}).call(this); }).call(this);
})(); })();

View File

@ -14,4 +14,4 @@
_c = _b.address; _c = _b.address;
street = _c[0]; street = _c[0];
city = _c[1]; city = _c[1];
})(); })();

View File

@ -7,4 +7,4 @@
tim: 11 tim: 11
}; };
matrix = [1, 0, 1, 0, 0, 1, 1, 1, 0]; matrix = [1, 0, 1, 0, 0, 1, 1, 1, 0];
})(); })();

View File

@ -40,4 +40,4 @@
} }
return _a; return _a;
}).call(this); }).call(this);
})(); })();

View File

@ -5,4 +5,4 @@
_a = [and_switch, bait]; _a = [and_switch, bait];
bait = _a[0]; bait = _a[0];
and_switch = _a[1]; and_switch = _a[1];
})(); })();

View File

@ -18,4 +18,4 @@
} }
return _f; return _f;
}; };
})(); })();

View File

@ -7,4 +7,4 @@
return num = 10; return num = 10;
}; };
new_num = change_numbers(); new_num = change_numbers();
})(); })();

View File

@ -3,4 +3,4 @@
numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
three_to_six = numbers.slice(3, 6 + 1); three_to_six = numbers.slice(3, 6 + 1);
numbers_copy = numbers.slice(0, numbers.length); numbers_copy = numbers.slice(0, numbers.length);
})(); })();

View File

@ -1,4 +1,4 @@
(function(){ (function(){
var _a; var _a;
(_a = lottery.draw_winner()) == undefined ? undefined : _a.address == undefined ? undefined : _a.address.zipcode; (_a = lottery.draw_winner()) == undefined ? undefined : _a.address == undefined ? undefined : _a.address.zipcode;
})(); })();

View File

@ -13,4 +13,4 @@
alert("Gold: " + gold); alert("Gold: " + gold);
alert("Silver: " + silver); alert("Silver: " + silver);
alert("The Field: " + the_field); alert("The Field: " + the_field);
})(); })();

View File

@ -2,4 +2,4 @@
var numbers; var numbers;
numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
numbers.splice.apply(numbers, [3, 6 - 3 + 1].concat([-3, -4, -5, -6])); numbers.splice.apply(numbers, [3, 6 - 3 + 1].concat([-3, -4, -5, -6]));
})(); })();

View File

@ -6,4 +6,4 @@ or no money in my purse, and nothing particular \
to interest me on shore, I thought I would sail \ to interest me on shore, I thought I would sail \
about a little and see the watery part of the \ about a little and see the watery part of the \
world..."; world...";
})(); })();

View File

@ -34,4 +34,4 @@
tom = new Horse("Tommy the Palomino"); tom = new Horse("Tommy the Palomino");
sam.move(); sam.move();
tom.move(); tom.move();
})(); })();

View File

@ -15,4 +15,4 @@
} else { } else {
go_to_work(); go_to_work();
} }
})(); })();

View File

@ -7,4 +7,4 @@
} finally { } finally {
clean_up(); clean_up();
} }
})(); })();

View File

@ -19,4 +19,4 @@ One fell out and bumped his head.");
} }
return _a; return _a;
}).call(this); }).call(this);
})(); })();

View File

@ -235,7 +235,7 @@ cubed_list = (function() {
</h2> </h2>
<p> <p>
The CoffeeScript compiler is written in pure CoffeeScript, using a The CoffeeScript compiler is written in pure CoffeeScript, using a
<a href="http://github.com/jashkenas/coffee-script/blob/master/src/grammar.coffee">small DSL</a> <a href="http://github.com/jashkenas/coffee-script/blob/master/src/grammar.coffee">small DSL</a>
on top of the <a href="http://github.com/zaach/jison">Jison parser generator</a>, and is available on top of the <a href="http://github.com/zaach/jison">Jison parser generator</a>, and is available
as a <a href="http://nodejs.org/">Node.js</a> utility. The core compiler however, as a <a href="http://nodejs.org/">Node.js</a> utility. The core compiler however,
@ -311,6 +311,14 @@ sudo bin/cake install</pre>
conjunction with <tt>--watch</tt>) conjunction with <tt>--watch</tt>)
</td> </td>
</tr> </tr>
<tr>
<td><code>-s, --stdio</code></td>
<td>
Pipe in CoffeeScript to STDIN and get back JavaScript over STDOUT.
Good for use with processes written in other languages. An example:<br />
<tt>cat src/cake.coffee | coffee -s</tt>
</td>
</tr>
<tr> <tr>
<td><code>-e, --eval</code></td> <td><code>-e, --eval</code></td>
<td> <td>
@ -1624,7 +1632,7 @@ task(<span class="String"><span class="String">'</span>test<span class="String">
<span id="change_log" class="bookmark"></span> <span id="change_log" class="bookmark"></span>
Change Log Change Log
</h2> </h2>
<p> <p>
<b class="header" style="margin-top: 20px;">0.5.1</b> <b class="header" style="margin-top: 20px;">0.5.1</b>
Improvements to null soaking with the existential operator, including Improvements to null soaking with the existential operator, including

View File

@ -19,9 +19,9 @@ SWITCHES: [
['-l', '--lint', 'pipe the compiled JavaScript through JSLint'] ['-l', '--lint', 'pipe the compiled JavaScript through JSLint']
['-s', '--stdio', 'listen for and compile scripts over stdio'] ['-s', '--stdio', 'listen for and compile scripts over stdio']
['-e', '--eval', 'compile a string from the command line'] ['-e', '--eval', 'compile a string from the command line']
['-n', '--no-wrap', 'compile without the top-level function wrapper']
['-t', '--tokens', 'print the tokens that the lexer produces'] ['-t', '--tokens', 'print the tokens that the lexer produces']
['-tr','--tree', 'print the parse tree that Jison produces'] ['-tr','--tree', 'print the parse tree that Jison produces']
['-n', '--no-wrap', 'compile without the top-level function wrapper']
['-v', '--version', 'display CoffeeScript version'] ['-v', '--version', 'display CoffeeScript version']
['-h', '--help', 'display this help message'] ['-h', '--help', 'display this help message']
] ]