haml-more 0.4.0.c → 0.4.0.d

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/vendor/coffee-script/Cakefile +8 -0
  2. data/vendor/coffee-script/Rakefile +11 -0
  3. data/vendor/coffee-script/documentation/index.html.erb +85 -50
  4. data/vendor/coffee-script/documentation/js/aliases.js +1 -1
  5. data/vendor/coffee-script/documentation/js/arguments.js +1 -1
  6. data/vendor/coffee-script/documentation/js/array_comprehensions.js +1 -1
  7. data/vendor/coffee-script/documentation/js/assignment.js +1 -1
  8. data/vendor/coffee-script/documentation/js/cake_tasks.js +1 -1
  9. data/vendor/coffee-script/documentation/js/comparisons.js +1 -1
  10. data/vendor/coffee-script/documentation/js/conditionals.js +1 -1
  11. data/vendor/coffee-script/documentation/js/embedded.js +1 -1
  12. data/vendor/coffee-script/documentation/js/existence.js +1 -1
  13. data/vendor/coffee-script/documentation/js/expressions.js +1 -1
  14. data/vendor/coffee-script/documentation/js/expressions_assignment.js +1 -1
  15. data/vendor/coffee-script/documentation/js/expressions_comprehension.js +1 -1
  16. data/vendor/coffee-script/documentation/js/expressions_try.js +1 -1
  17. data/vendor/coffee-script/documentation/js/fat_arrow.js +1 -1
  18. data/vendor/coffee-script/documentation/js/functions.js +1 -1
  19. data/vendor/coffee-script/documentation/js/heredocs.js +1 -1
  20. data/vendor/coffee-script/documentation/js/multiple_return_values.js +1 -1
  21. data/vendor/coffee-script/documentation/js/object_comprehensions.js +1 -1
  22. data/vendor/coffee-script/documentation/js/object_extraction.js +1 -1
  23. data/vendor/coffee-script/documentation/js/objects_and_arrays.js +1 -1
  24. data/vendor/coffee-script/documentation/js/overview.js +1 -1
  25. data/vendor/coffee-script/documentation/js/parallel_assignment.js +1 -1
  26. data/vendor/coffee-script/documentation/js/range_comprehensions.js +1 -1
  27. data/vendor/coffee-script/documentation/js/scope.js +1 -1
  28. data/vendor/coffee-script/documentation/js/slices.js +1 -1
  29. data/vendor/coffee-script/documentation/js/soaks.js +1 -1
  30. data/vendor/coffee-script/documentation/js/splats.js +1 -1
  31. data/vendor/coffee-script/documentation/js/splices.js +1 -1
  32. data/vendor/coffee-script/documentation/js/strings.js +1 -1
  33. data/vendor/coffee-script/documentation/js/super.js +1 -1
  34. data/vendor/coffee-script/documentation/js/switch.js +1 -1
  35. data/vendor/coffee-script/documentation/js/try.js +1 -1
  36. data/vendor/coffee-script/documentation/js/while.js +1 -1
  37. data/vendor/coffee-script/extras/EXTRAS +9 -1
  38. data/vendor/coffee-script/extras/coffee-script.js +1 -0
  39. data/vendor/coffee-script/index.html +83 -48
  40. data/vendor/coffee-script/lib/cake.js +30 -32
  41. data/vendor/coffee-script/lib/coffee-script.js +12 -16
  42. data/vendor/coffee-script/lib/command_line.js +64 -74
  43. data/vendor/coffee-script/lib/grammar.js +1 -1
  44. data/vendor/coffee-script/lib/lexer.js +1 -1
  45. data/vendor/coffee-script/lib/narwhal.js +1 -1
  46. data/vendor/coffee-script/lib/nodes.js +48 -44
  47. data/vendor/coffee-script/lib/optparse.js +11 -17
  48. data/vendor/coffee-script/lib/repl.js +1 -1
  49. data/vendor/coffee-script/lib/rewriter.js +1 -1
  50. data/vendor/coffee-script/lib/scope.js +1 -1
  51. data/vendor/coffee-script/package.json +1 -1
  52. data/vendor/coffee-script/src/cake.coffee +15 -15
  53. data/vendor/coffee-script/src/coffee-script.coffee +6 -6
  54. data/vendor/coffee-script/src/command_line.coffee +43 -39
  55. data/vendor/coffee-script/src/nodes.coffee +43 -41
  56. data/vendor/coffee-script/src/optparse.coffee +6 -13
  57. data/vendor/coffee-script/test/test_destructuring_assignment.coffee +6 -0
  58. metadata +7 -6
@@ -38,6 +38,14 @@ task 'build:underscore', 'rebuild the Underscore.coffee documentation page', ->
38
38
  exec 'uv -s coffeescript -t idle -h examples/underscore.coffee > documentation/underscore.html'
39
39
 
40
40
 
41
+ task 'build:browser', 'rebuild the merged script for inclusion in the browser', ->
42
+ exec 'rake browser'
43
+
44
+
45
+ task 'doc', 'watch and continually rebuild the documentation', ->
46
+ exec 'rake doc'
47
+
48
+
41
49
  task 'test', 'run the CoffeeScript language test suite', ->
42
50
  process.mixin require 'assert'
43
51
  test_count: 0
@@ -1,6 +1,8 @@
1
1
  require 'erb'
2
2
  require 'fileutils'
3
3
  require 'rake/testtask'
4
+ require 'rubygems'
5
+ require 'yui/compressor'
4
6
 
5
7
  desc "Build the documentation page"
6
8
  task :doc do
@@ -18,3 +20,12 @@ task :doc do
18
20
  sleep 1
19
21
  end
20
22
  end
23
+
24
+ desc "Build the single concatenated and minified script for the browser"
25
+ task :browser do
26
+ sources = %w(rewriter.js lexer.js parser.js scope.js nodes.js coffee-script.js)
27
+ code = sources.map {|s| File.read('lib/' + s) }.join('')
28
+ code = YUI::JavaScriptCompressor.new.compress(code)
29
+ File.open('extras/coffee-script.js', 'w+') {|f| f.write(code) }
30
+ end
31
+
@@ -1,7 +1,7 @@
1
1
  <%
2
2
  require 'uv'
3
3
  def code_for(file, executable=false)
4
- @stripper ||= /(\A\(function\(\)\{\n|\}\)\(\);\Z|^ )/
4
+ @stripper ||= /(\A\(function\(\)\{\n|\}\)\(\);\n*\Z|^ )/
5
5
  return '' unless File.exists?("documentation/js/#{file}.js")
6
6
  cs = File.read("documentation/coffee/#{file}.coffee")
7
7
  js = File.read("documentation/js/#{file}.js").gsub(@stripper, '')
@@ -60,6 +60,7 @@
60
60
  <a href="#comparisons">Chained Comparisons</a>
61
61
  <a href="#strings">Multiline Strings and Heredocs</a>
62
62
  <a href="#cake">Cake, and Cakefiles</a>
63
+ <a href="#scripts">"text/coffeescript" Script Tags</a>
63
64
  <a href="#resources">Resources</a>
64
65
  <a href="#change_log">Change Log</a>
65
66
  </div>
@@ -107,7 +108,7 @@ alert reverse '!tpircseeffoC'</textarea>
107
108
 
108
109
  <p>
109
110
  <b>Latest Version:</b>
110
- <a href="http://github.com/jashkenas/coffee-script/tarball/0.5.1">0.5.1</a>
111
+ <a href="http://github.com/jashkenas/coffee-script/tarball/0.5.2">0.5.2</a>
111
112
  </p>
112
113
 
113
114
  <h2>
@@ -138,7 +139,7 @@ alert reverse '!tpircseeffoC'</textarea>
138
139
  </h2>
139
140
 
140
141
  <p>
141
- The CoffeeScript compiler is written in pure CoffeeScript, using a
142
+ The CoffeeScript compiler is written in pure CoffeeScript, using a
142
143
  <a href="http://github.com/jashkenas/coffee-script/blob/master/src/grammar.coffee">small DSL</a>
143
144
  on top of the <a href="http://github.com/zaach/jison">Jison parser generator</a>, and is available
144
145
  as a <a href="http://nodejs.org/">Node.js</a> utility. The core compiler however,
@@ -152,7 +153,7 @@ alert reverse '!tpircseeffoC'</textarea>
152
153
  <a href="http://nodejs.org/">Node.js</a>, 0.1.30 or higher. Then clone the CoffeeScript
153
154
  <a href="http://github.com/jashkenas/coffee-script">source repository</a>
154
155
  from GitHub, or download the latest
155
- release: <a href="http://github.com/jashkenas/coffee-script/tarball/0.5.1">0.5.1</a>.
156
+ release: <a href="http://github.com/jashkenas/coffee-script/tarball/0.5.2">0.5.2</a>.
156
157
  To install the CoffeeScript compiler system-wide
157
158
  under <tt>/usr/local</tt>, open the directory and run:
158
159
  </p>
@@ -214,6 +215,14 @@ sudo bin/cake install</pre>
214
215
  conjunction with <tt>--watch</tt>)
215
216
  </td>
216
217
  </tr>
218
+ <tr>
219
+ <td><code>-s, --stdio</code></td>
220
+ <td>
221
+ Pipe in CoffeeScript to STDIN and get back JavaScript over STDOUT.
222
+ Good for use with processes written in other languages. An example:<br />
223
+ <tt>cat src/cake.coffee | coffee -s</tt>
224
+ </td>
225
+ </tr>
217
226
  <tr>
218
227
  <td><code>-e, --eval</code></td>
219
228
  <td>
@@ -717,6 +726,34 @@ coffee --print app/scripts/*.coffee > concatenation.js</pre>
717
726
  </p>
718
727
  <%= code_for('cake_tasks') %>
719
728
 
729
+ <h2>
730
+ <span id="scripts" class="bookmark"></span>
731
+ "text/coffeescript" Script Tags
732
+ </h2>
733
+
734
+ <p>
735
+ While it's not recommended for serious use, CoffeeScripts may be included
736
+ directly within the browser using <tt>&lt;script type="text/coffeescript"&gt;</tt>
737
+ tags. The codebase includes a compressed and minified version of the compiler
738
+ (<a href="extras/coffee-script.js">Download current version here, 43k when gzipped</a>).
739
+ Include <tt>coffee-script.js</tt> on the page <b>after</b> any <tt>text/coffeescript</tt> tags
740
+ with inline CoffeeScript, and it will compile and evaluate them in order.
741
+ </p>
742
+
743
+ <p>
744
+ In fact, the little bit of glue script that runs "Try CoffeeScript" above,
745
+ as well as jQuery for the menu, is implemented in just this way.
746
+ View source and look at the bottom of the page to see the example.
747
+ Including the script also gives you access to <tt>CoffeeScript.compile()</tt>
748
+ so you can pop open Firebug and try compiling some strings.
749
+ </p>
750
+
751
+ <p>
752
+ The usual caveats about CoffeeScript apply &mdash; your inline scripts will
753
+ run within a closure wrapper, so if you want to expose global variables or
754
+ functions, attach them to the <tt>window</tt> object.
755
+ </p>
756
+
720
757
  <h2>
721
758
  <span id="resources" class="bookmark"></span>
722
759
  Resources
@@ -745,6 +782,15 @@ coffee --print app/scripts/*.coffee > concatenation.js</pre>
745
782
  Change Log
746
783
  </h2>
747
784
 
785
+ <p>
786
+ <b class="header" style="margin-top: 20px;">0.5.2</b>
787
+ Added a compressed version of the compiler for inclusion in web pages as
788
+ <br /><tt>extras/coffee-script.js</tt>. It'll automatically run any script tags
789
+ with type <tt>text/coffeescript</tt> for you. Added a <tt>--stdio</tt> option
790
+ to the <tt>coffee</tt> command, for piped-in compiles.
791
+ </p>
792
+
793
+
748
794
  <p>
749
795
  <b class="header" style="margin-top: 20px;">0.5.1</b>
750
796
  Improvements to null soaking with the existential operator, including
@@ -915,53 +961,42 @@ coffee --print app/scripts/*.coffee > concatenation.js</pre>
915
961
 
916
962
  </div>
917
963
 
918
- <script type="text/javascript" src="lib/rewriter.js"></script>
919
- <script type="text/javascript" src="lib/lexer.js"></script>
920
- <script type="text/javascript" src="lib/parser.js"></script>
921
- <script type="text/javascript" src="lib/scope.js"></script>
922
- <script type="text/javascript" src="lib/nodes.js"></script>
923
- <script type="text/javascript" src="lib/coffee-script.js"></script>
924
-
925
- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
926
-
927
- <script type="text/javascript">
928
- window.repl_compile = function() {
929
- var source = $('#repl_source').val();
930
- window.compiled_js = '';
931
- try {
932
- window.compiled_js = CoffeeScript.compile(source, {no_wrap: true});
933
- } catch(error) {
934
- alert(error);
935
- }
936
- $('#repl_results').html(window.compiled_js);
937
- };
938
- window.repl_run = function() {
939
- try {
940
- eval(window.compiled_js);
941
- } catch(error) {
942
- alert(error);
943
- }
944
- };
945
-
946
- var nav = $('.navigation');
947
- var currentNav = null;
948
- var closeMenus = function() {
949
- if (currentNav) currentNav.removeClass('active');
950
- currentNav = null;
951
- };
952
- nav.click(function(e) {
953
- if (e.target.tagName.toLowerCase() == 'a') return;
954
- if (this !== (currentNav && currentNav[0])) {
955
- closeMenus();
956
- currentNav = $(this);
957
- currentNav.addClass('active');
958
- }
959
- return false;
960
- });
961
- $(document.body).click(function() {
962
- closeMenus();
963
- });
964
+ <script type="text/coffeescript">
965
+
966
+ window.repl_compile: ->
967
+ source: $('#repl_source').val()
968
+ window.compiled_js: ''
969
+ try
970
+ window.compiled_js: CoffeeScript.compile source, {no_wrap: true}
971
+ catch error then alert error
972
+ $('#repl_results').html window.compiled_js
973
+
974
+ window.repl_run: ->
975
+ try
976
+ eval window.compiled_js
977
+ catch error then alert error
978
+
979
+ nav: $('.navigation')
980
+ current_nav: null
981
+
982
+ close_menus: ->
983
+ current_nav.removeClass 'active' if current_nav
984
+ current_nav: null
985
+
986
+ nav.click (e) ->
987
+ return if e.target.tagName.toLowerCase() is 'a'
988
+ if this isnt (current_nav and current_nav[0])
989
+ close_menus();
990
+ current_nav: $(this)
991
+ current_nav.addClass 'active'
992
+ false
993
+
994
+ $(document.body).click -> close_menus()
995
+
964
996
  </script>
965
997
 
998
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
999
+ <script src="extras/coffee-script.js"></script>
1000
+
966
1001
  </body>
967
1002
  </html>
@@ -11,4 +11,4 @@
11
11
  }
12
12
  car.speed < speed_limit ? accelerate() : null;
13
13
  print("My name is " + this.name);
14
- })();
14
+ })();
@@ -5,4 +5,4 @@
5
5
  return alert(arguments.reverse());
6
6
  };
7
7
  backwards("stairway", "to", "heaven");
8
- })();
8
+ })();
@@ -23,4 +23,4 @@
23
23
  }
24
24
  }
25
25
  }
26
- })();
26
+ })();
@@ -2,4 +2,4 @@
2
2
  var difficulty, greeting;
3
3
  greeting = "Hello CoffeeScript";
4
4
  difficulty = 0.5;
5
- })();
5
+ })();
@@ -11,4 +11,4 @@
11
11
  }
12
12
  return _a;
13
13
  });
14
- })();
14
+ })();
@@ -2,4 +2,4 @@
2
2
  var cholesterol, healthy;
3
3
  cholesterol = 127;
4
4
  healthy = (200 > cholesterol) && (cholesterol > 60);
5
- })();
5
+ })();
@@ -9,4 +9,4 @@
9
9
  }
10
10
  date = friday ? sue : jill;
11
11
  expensive = expensive || do_the_math();
12
- })();
12
+ })();
@@ -3,4 +3,4 @@
3
3
  hi = function() {
4
4
  return [document.title, "Hello JavaScript"].join(": ");
5
5
  };
6
- })();
6
+ })();
@@ -4,4 +4,4 @@
4
4
  solipsism = true;
5
5
  }
6
6
  speed = (typeof speed !== "undefined" && speed !== null) ? speed : 140;
7
- })();
7
+ })();
@@ -10,4 +10,4 @@
10
10
  }
11
11
  };
12
12
  eldest = 24 > 21 ? "Liz" : "Ike";
13
- })();
13
+ })();
@@ -1,4 +1,4 @@
1
1
  (function(){
2
2
  var one, six, three, two;
3
3
  six = ((one = 1)) + ((two = 2)) + ((three = 3));
4
- })();
4
+ })();
@@ -9,4 +9,4 @@
9
9
  }}
10
10
  return _a;
11
11
  }).call(this).slice(0, 10);
12
- })();
12
+ })();
@@ -6,4 +6,4 @@
6
6
  return "And the error is ... " + error;
7
7
  }
8
8
  }).call(this));
9
- })();
9
+ })();
@@ -12,4 +12,4 @@
12
12
  });
13
13
  })(this));
14
14
  };
15
- })();
15
+ })();
@@ -6,4 +6,4 @@
6
6
  cube = function cube(x) {
7
7
  return square(x) * x;
8
8
  };
9
- })();
9
+ })();
@@ -1,4 +1,4 @@
1
1
  (function(){
2
2
  var html;
3
3
  html = "<strong>\n cup of coffeescript\n</strong>";
4
- })();
4
+ })();
@@ -8,4 +8,4 @@
8
8
  city = _a[0];
9
9
  temp = _a[1];
10
10
  forecast = _a[2];
11
- })();
11
+ })();
@@ -14,4 +14,4 @@
14
14
  }}
15
15
  return _a;
16
16
  }).call(this);
17
- })();
17
+ })();
@@ -14,4 +14,4 @@
14
14
  _c = _b.address;
15
15
  street = _c[0];
16
16
  city = _c[1];
17
- })();
17
+ })();
@@ -7,4 +7,4 @@
7
7
  tim: 11
8
8
  };
9
9
  matrix = [1, 0, 1, 0, 0, 1, 1, 1, 0];
10
- })();
10
+ })();
@@ -40,4 +40,4 @@
40
40
  }
41
41
  return _a;
42
42
  }).call(this);
43
- })();
43
+ })();
@@ -5,4 +5,4 @@
5
5
  _a = [and_switch, bait];
6
6
  bait = _a[0];
7
7
  and_switch = _a[1];
8
- })();
8
+ })();
@@ -18,4 +18,4 @@
18
18
  }
19
19
  return _f;
20
20
  };
21
- })();
21
+ })();
@@ -7,4 +7,4 @@
7
7
  return num = 10;
8
8
  };
9
9
  new_num = change_numbers();
10
- })();
10
+ })();
@@ -3,4 +3,4 @@
3
3
  numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
4
4
  three_to_six = numbers.slice(3, 6 + 1);
5
5
  numbers_copy = numbers.slice(0, numbers.length);
6
- })();
6
+ })();
@@ -1,4 +1,4 @@
1
1
  (function(){
2
2
  var _a;
3
3
  (_a = lottery.draw_winner()) == undefined ? undefined : _a.address == undefined ? undefined : _a.address.zipcode;
4
- })();
4
+ })();
@@ -13,4 +13,4 @@
13
13
  alert("Gold: " + gold);
14
14
  alert("Silver: " + silver);
15
15
  alert("The Field: " + the_field);
16
- })();
16
+ })();
@@ -2,4 +2,4 @@
2
2
  var numbers;
3
3
  numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
4
4
  numbers.splice.apply(numbers, [3, 6 - 3 + 1].concat([-3, -4, -5, -6]));
5
- })();
5
+ })();
@@ -6,4 +6,4 @@ or no money in my purse, and nothing particular \
6
6
  to interest me on shore, I thought I would sail \
7
7
  about a little and see the watery part of the \
8
8
  world...";
9
- })();
9
+ })();
@@ -34,4 +34,4 @@
34
34
  tom = new Horse("Tommy the Palomino");
35
35
  sam.move();
36
36
  tom.move();
37
- })();
37
+ })();