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'
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")
cs = File.read("documentation/coffee/#{file}.coffee")
js = File.read("documentation/js/#{file}.js").gsub(@stripper, '')
@ -138,7 +138,7 @@ alert reverse '!tpircseeffoC'</textarea>
</h2>
<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>
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,
@ -214,6 +214,14 @@ sudo bin/cake install</pre>
conjunction with <tt>--watch</tt>)
</td>
</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>
<td><code>-e, --eval</code></td>
<td>
@ -744,7 +752,7 @@ coffee --print app/scripts/*.coffee > concatenation.js</pre>
<span id="change_log" class="bookmark"></span>
Change Log
</h2>
<p>
<b class="header" style="margin-top: 20px;">0.5.1</b>
Improvements to null soaking with the existential operator, including

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,4 +2,4 @@
var numbers;
numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
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 \
about a little and see the watery part of the \
world...";
})();
})();

View File

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

View File

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

View File

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

View File

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

View File

@ -235,7 +235,7 @@ cubed_list = (function() {
</h2>
<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>
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,
@ -311,6 +311,14 @@ sudo bin/cake install</pre>
conjunction with <tt>--watch</tt>)
</td>
</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>
<td><code>-e, --eval</code></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>
Change Log
</h2>
<p>
<b class="header" style="margin-top: 20px;">0.5.1</b>
Improvements to null soaking with the existential operator, including

View File

@ -19,9 +19,9 @@ SWITCHES: [
['-l', '--lint', 'pipe the compiled JavaScript through JSLint']
['-s', '--stdio', 'listen for and compile scripts over stdio']
['-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']
['-tr','--tree', 'print the parse tree that Jison produces']
['-n', '--no-wrap', 'compile without the top-level function wrapper']
['-v', '--version', 'display CoffeeScript version']
['-h', '--help', 'display this help message']
]