luca 0.9.89 → 0.9.91

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. data/CHANGELOG +11 -1
  2. data/Gemfile +5 -2
  3. data/Gemfile.lock +84 -56
  4. data/Rakefile +10 -2
  5. data/app/assets/javascripts/luca/components/application.coffee +82 -89
  6. data/app/assets/javascripts/luca/components/collection_view.coffee +9 -5
  7. data/app/assets/javascripts/luca/components/controller.coffee +72 -11
  8. data/app/assets/javascripts/luca/components/fields/base.coffee +61 -8
  9. data/app/assets/javascripts/luca/components/fields/button_field.coffee +53 -7
  10. data/app/assets/javascripts/luca/components/fields/checkbox_array.coffee +12 -7
  11. data/app/assets/javascripts/luca/components/fields/text_field.coffee +1 -1
  12. data/app/assets/javascripts/luca/components/form_view.coffee +2 -2
  13. data/app/assets/javascripts/luca/components/grid_layout_view.coffee +0 -1
  14. data/app/assets/javascripts/luca/components/page.coffee +1 -0
  15. data/app/assets/javascripts/luca/components/table_view.coffee +2 -2
  16. data/app/assets/javascripts/luca/concerns/dom_helpers.coffee +2 -2
  17. data/app/assets/javascripts/luca/containers/card_view.coffee +84 -54
  18. data/app/assets/javascripts/luca/containers/container.coffee +126 -46
  19. data/app/assets/javascripts/luca/containers/modal_view.coffee +9 -9
  20. data/app/assets/javascripts/luca/containers/page_controller.coffee +25 -0
  21. data/app/assets/javascripts/luca/containers/panel_toolbar.coffee +1 -1
  22. data/app/assets/javascripts/luca/containers/viewport.coffee +2 -5
  23. data/app/assets/javascripts/luca/core/collection.coffee +18 -4
  24. data/app/assets/javascripts/luca/core/model.coffee +1 -1
  25. data/app/assets/javascripts/luca/core/panel.coffee +1 -1
  26. data/app/assets/javascripts/luca/core/view.coffee +26 -7
  27. data/app/assets/javascripts/luca/development/code_sync_manager.coffee +51 -4
  28. data/app/assets/javascripts/luca/development/console.coffee +1 -1
  29. data/app/assets/javascripts/luca/framework.coffee +1 -1
  30. data/app/assets/javascripts/luca/index.coffee +1 -0
  31. data/app/assets/javascripts/luca/util/luca.coffee +2 -1
  32. data/app/assets/stylesheets/luca/components/viewport.scss +0 -4
  33. data/bin/luca +14 -0
  34. data/docs/framework.json +1 -1
  35. data/docs/luca-framework-documentation.js +1 -0
  36. data/lib/luca/cli/generate.rb +37 -0
  37. data/lib/luca/cli/server.rb +20 -0
  38. data/lib/luca/cli/sync.rb +40 -0
  39. data/lib/luca/cli/watch.rb +16 -0
  40. data/lib/luca/cli.rb +68 -0
  41. data/lib/luca/collection/endpoint.rb +1 -0
  42. data/lib/luca/component_definition.rb +23 -5
  43. data/lib/luca/luca_application.rb +18 -7
  44. data/lib/luca/rails/version.rb +1 -1
  45. data/lib/luca/server.rb +7 -0
  46. data/lib/luca/stylesheet.rb +2 -3
  47. data/lib/luca/version.rb +3 -0
  48. data/lib/luca/watcher.rb +72 -0
  49. data/lib/luca.rb +8 -1
  50. data/luca.gemspec +14 -7
  51. data/site/.bundle/config +2 -0
  52. data/site/.gitignore +5 -0
  53. data/site/.rvmrc +1 -0
  54. data/site/CHANGELOG.md +41 -0
  55. data/site/DOCS.md +41 -0
  56. data/site/Gemfile +8 -0
  57. data/site/Gemfile.lock +134 -0
  58. data/site/LICENSE.md +19 -0
  59. data/site/config.rb +84 -0
  60. data/site/helpers/site_helpers.rb +20 -0
  61. data/site/html5bp-docs/README.md +38 -0
  62. data/site/html5bp-docs/contribute.md +104 -0
  63. data/site/html5bp-docs/crossdomain.md +21 -0
  64. data/site/html5bp-docs/css.md +135 -0
  65. data/site/html5bp-docs/extend.md +507 -0
  66. data/site/html5bp-docs/faq.md +77 -0
  67. data/site/html5bp-docs/htaccess.md +323 -0
  68. data/site/html5bp-docs/html.md +170 -0
  69. data/site/html5bp-docs/js.md +31 -0
  70. data/site/html5bp-docs/misc.md +25 -0
  71. data/site/html5bp-docs/usage.md +109 -0
  72. data/site/readme.md +47 -0
  73. data/site/source/.htaccess +540 -0
  74. data/site/source/404.html +157 -0
  75. data/site/source/app/assets/javascripts/dependencies.js.coffee +6 -0
  76. data/site/source/app/assets/javascripts/docs/application.coffee +64 -0
  77. data/site/source/app/assets/javascripts/docs/collections/docs_documentation.coffee +17 -0
  78. data/site/source/app/assets/javascripts/docs/collections/github_repositories.coffee +7 -0
  79. data/site/source/app/assets/javascripts/docs/collections/index.coffee +1 -0
  80. data/site/source/app/assets/javascripts/docs/collections/luca_documentation.coffee +17 -0
  81. data/site/source/app/assets/javascripts/docs/collections/public_gists.coffee +4 -0
  82. data/site/source/app/assets/javascripts/docs/config.coffee +5 -0
  83. data/site/source/app/assets/javascripts/docs/index.coffee +12 -0
  84. data/site/source/app/assets/javascripts/docs/lib/router.coffee +3 -0
  85. data/site/source/app/assets/javascripts/docs/lib/util.coffee +0 -0
  86. data/site/source/app/assets/javascripts/docs/models/component.coffee +99 -0
  87. data/site/source/app/assets/javascripts/docs/models/github_repository.coffee +3 -0
  88. data/site/source/app/assets/javascripts/docs/models/index.coffee +1 -0
  89. data/site/source/app/assets/javascripts/docs/templates/component_documentation.jst.ejs +55 -0
  90. data/site/source/app/assets/javascripts/docs/templates/examples_browser/overview.jst.ejs +4 -0
  91. data/site/source/app/assets/javascripts/docs/templates/examples_browser/selector.jst.ejs +11 -0
  92. data/site/source/app/assets/javascripts/docs/templates/github_repository.jst.ejs +4 -0
  93. data/site/source/app/assets/javascripts/docs/templates/layouts/main.jst.ejs +4 -0
  94. data/site/source/app/assets/javascripts/docs/templates/left_navigation.jst.ejs +5 -0
  95. data/site/source/app/assets/javascripts/docs/templates/pages/getting_started.jst.ejs +78 -0
  96. data/site/source/app/assets/javascripts/docs/templates/pages/home.jst.ejs +57 -0
  97. data/site/source/app/assets/javascripts/docs/views/components/code_editor/index.coffee +0 -0
  98. data/site/source/app/assets/javascripts/docs/views/components/code_editor.coffee +45 -0
  99. data/site/source/app/assets/javascripts/docs/views/components/component_documentation.coffee +72 -0
  100. data/site/source/app/assets/javascripts/docs/views/index.coffee +3 -0
  101. data/site/source/app/assets/javascripts/docs/views/pages/browse_source/details.coffee +37 -0
  102. data/site/source/app/assets/javascripts/docs/views/pages/browse_source/list.coffee +31 -0
  103. data/site/source/app/assets/javascripts/docs/views/pages/browse_source.coffee +46 -0
  104. data/site/source/app/assets/javascripts/docs/views/pages/component_editor.coffee +10 -0
  105. data/site/source/app/assets/javascripts/docs/views/pages/examples_browser/docs.coffee +12 -0
  106. data/site/source/app/assets/javascripts/docs/views/pages/examples_browser/source.coffee +13 -0
  107. data/site/source/app/assets/javascripts/docs/views/pages/examples_browser.coffee +102 -0
  108. data/site/source/app/assets/javascripts/docs/views/pages/home.coffee +10 -0
  109. data/site/source/app/assets/javascripts/docs/views/views/api_browser/index.coffee +43 -0
  110. data/site/source/app/assets/javascripts/docs/views/views/collection_view_examples/grid_layout_view_example.coffee +14 -0
  111. data/site/source/app/assets/javascripts/docs/views/views/collection_view_examples/table_view_example.coffee +39 -0
  112. data/site/source/app/assets/javascripts/docs/views/views/form_view_examples/basic_example.coffee +38 -0
  113. data/site/source/app/assets/javascripts/docs/views/views/form_view_examples/complex_layout.coffee +110 -0
  114. data/site/source/app/assets/javascripts/docs/views/views/top_navigation.coffee +6 -0
  115. data/site/source/app/assets/javascripts/docs-docs.js +1 -0
  116. data/site/source/app/assets/javascripts/luca-docs.js +1 -0
  117. data/site/source/app/assets/javascripts/luca-framework-documentation.js +1 -0
  118. data/site/source/app/assets/javascripts/site.js.coffee +4 -0
  119. data/site/source/app/assets/javascripts/vendor/codemirror.js +4786 -0
  120. data/site/source/app/assets/javascripts/vendor/coffeescript.js +346 -0
  121. data/site/source/app/assets/javascripts/vendor/css.js +465 -0
  122. data/site/source/app/assets/javascripts/vendor/htmlmixed.js +84 -0
  123. data/site/source/app/assets/javascripts/vendor/javascript.js +422 -0
  124. data/site/source/app/assets/javascripts/vendor/js-beautify.js +1353 -0
  125. data/site/source/app/assets/javascripts/vendor/modernizr-2.6.1.min.js +4 -0
  126. data/site/source/app/assets/javascripts/vendor/vim.js +2511 -0
  127. data/site/source/app/assets/stylesheets/docs/api-browser.css.scss +5 -0
  128. data/site/source/app/assets/stylesheets/docs/application.css.scss +35 -0
  129. data/site/source/app/assets/stylesheets/docs/browse-source.css.scss +5 -0
  130. data/site/source/app/assets/stylesheets/docs/scrollable-table.css.scss +5 -0
  131. data/site/source/app/assets/stylesheets/site.css.scss +2 -0
  132. data/site/source/app/assets/stylesheets/vendor/codemirror.css +240 -0
  133. data/site/source/app/assets/stylesheets/vendor/prettify-tomorrow-night-bright.css +160 -0
  134. data/site/source/app/assets/stylesheets/vendor/twilight.css +26 -0
  135. data/site/source/crossdomain.xml +15 -0
  136. data/site/source/documentation.html.haml +1 -0
  137. data/site/source/favicon_base.png +0 -0
  138. data/site/source/humans.txt +15 -0
  139. data/site/source/images/background.png +0 -0
  140. data/site/source/images/middleman.png +0 -0
  141. data/site/source/index.html.haml +1 -0
  142. data/site/source/layouts/layout.haml +55 -0
  143. data/site/source/readme.md +63 -0
  144. data/site/source/robots.txt +3 -0
  145. data/spec/javascripts/components/collection_view_spec.coffee +1 -1
  146. data/spec/javascripts/containers/card_view_spec.coffee +58 -5
  147. data/spec/javascripts/core/collection_spec.coffee +1 -1
  148. data/spec/javascripts/core/view_spec.coffee +2 -2
  149. data/vendor/assets/javascripts/backbone-min.js +37 -33
  150. data/vendor/assets/javascripts/backbone-query.min.js +1 -1
  151. data/vendor/assets/javascripts/jquery.js +5 -4
  152. data/vendor/assets/javascripts/luca-dependencies.min.js +8 -6
  153. data/vendor/assets/javascripts/luca-development.min.js +1 -1
  154. data/vendor/assets/javascripts/luca.full.min.js +12 -10
  155. data/vendor/assets/javascripts/luca.min.js +5 -5
  156. data/vendor/assets/javascripts/underscore-min.js +1 -5
  157. data/vendor/assets/javascripts/underscore-string.min.js +1 -1
  158. data/vendor/assets/stylesheets/luca-components.css +0 -2
  159. data/vendor/assets/stylesheets/luca-development.css +1 -1
  160. metadata +215 -39
  161. data/app/assets/javascripts/luca/components/page_controller.coffee +0 -3
  162. data/app/assets/javascripts/luca/core/collection_view.coffee +0 -150
  163. data/site/assets/bootstrap.min.js +0 -7
  164. data/site/assets/dependencies.js +0 -94
  165. data/site/assets/glyphicons-halflings-white.png +0 -0
  166. data/site/assets/glyphicons-halflings.png +0 -0
  167. data/site/assets/luca-ui-bootstrap.css +0 -1331
  168. data/site/assets/luca-ui-bootstrap.js +0 -9
  169. data/site/assets/luca-ui-development-tools.css +0 -234
  170. data/site/assets/luca-ui-development-tools.js +0 -18561
  171. data/site/assets/luca-ui-development-tools.min.js +0 -15
  172. data/site/assets/luca-ui-full.min.js +0 -8
  173. data/site/assets/luca-ui.min.js +0 -4
  174. data/site/assets/sandbox.css +0 -62
  175. data/site/assets/sandbox.js +0 -469
  176. data/site/docs/application.html +0 -41
  177. data/site/docs/caching.html +0 -43
  178. data/site/docs/collection.html +0 -75
  179. data/site/docs/collection_manager.html +0 -71
  180. data/site/docs/containers.html +0 -118
  181. data/site/docs/events.html +0 -153
  182. data/site/docs/view.html +0 -128
  183. data/site/img/glyphicons-halflings-white.png +0 -0
  184. data/site/img/glyphicons-halflings.png +0 -0
  185. data/site/index.html +0 -20
  186. data/site/source-map.js +0 -1
@@ -0,0 +1,346 @@
1
+ /**
2
+ * Link to the project's GitHub page:
3
+ * https://github.com/pickhardt/coffeescript-codemirror-mode
4
+ */
5
+ CodeMirror.defineMode('coffeescript', function(conf) {
6
+ var ERRORCLASS = 'error';
7
+
8
+ function wordRegexp(words) {
9
+ return new RegExp("^((" + words.join(")|(") + "))\\b");
10
+ }
11
+
12
+ var singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!\?]");
13
+ var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\},:`=;\\.]');
14
+ var doubleOperators = new RegExp("^((\->)|(\=>)|(\\+\\+)|(\\+\\=)|(\\-\\-)|(\\-\\=)|(\\*\\*)|(\\*\\=)|(\\/\\/)|(\\/\\=)|(==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//))");
15
+ var doubleDelimiters = new RegExp("^((\\.\\.)|(\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))");
16
+ var tripleDelimiters = new RegExp("^((\\.\\.\\.)|(//=)|(>>=)|(<<=)|(\\*\\*=))");
17
+ var identifiers = new RegExp("^[_A-Za-z$][_A-Za-z$0-9]*");
18
+ var properties = new RegExp("^(@|this\.)[_A-Za-z$][_A-Za-z$0-9]*");
19
+
20
+ var wordOperators = wordRegexp(['and', 'or', 'not',
21
+ 'is', 'isnt', 'in',
22
+ 'instanceof', 'typeof']);
23
+ var indentKeywords = ['for', 'while', 'loop', 'if', 'unless', 'else',
24
+ 'switch', 'try', 'catch', 'finally', 'class'];
25
+ var commonKeywords = ['break', 'by', 'continue', 'debugger', 'delete',
26
+ 'do', 'in', 'of', 'new', 'return', 'then',
27
+ 'this', 'throw', 'when', 'until'];
28
+
29
+ var keywords = wordRegexp(indentKeywords.concat(commonKeywords));
30
+
31
+ indentKeywords = wordRegexp(indentKeywords);
32
+
33
+
34
+ var stringPrefixes = new RegExp("^('{3}|\"{3}|['\"])");
35
+ var regexPrefixes = new RegExp("^(/{3}|/)");
36
+ var commonConstants = ['Infinity', 'NaN', 'undefined', 'null', 'true', 'false', 'on', 'off', 'yes', 'no'];
37
+ var constants = wordRegexp(commonConstants);
38
+
39
+ // Tokenizers
40
+ function tokenBase(stream, state) {
41
+ // Handle scope changes
42
+ if (stream.sol()) {
43
+ var scopeOffset = state.scopes[0].offset;
44
+ if (stream.eatSpace()) {
45
+ var lineOffset = stream.indentation();
46
+ if (lineOffset > scopeOffset) {
47
+ return 'indent';
48
+ } else if (lineOffset < scopeOffset) {
49
+ return 'dedent';
50
+ }
51
+ return null;
52
+ } else {
53
+ if (scopeOffset > 0) {
54
+ dedent(stream, state);
55
+ }
56
+ }
57
+ }
58
+ if (stream.eatSpace()) {
59
+ return null;
60
+ }
61
+
62
+ var ch = stream.peek();
63
+
64
+ // Handle docco title comment (single line)
65
+ if (stream.match("####")) {
66
+ stream.skipToEnd();
67
+ return 'comment';
68
+ }
69
+
70
+ // Handle multi line comments
71
+ if (stream.match("###")) {
72
+ state.tokenize = longComment;
73
+ return state.tokenize(stream, state);
74
+ }
75
+
76
+ // Single line comment
77
+ if (ch === '#') {
78
+ stream.skipToEnd();
79
+ return 'comment';
80
+ }
81
+
82
+ // Handle number literals
83
+ if (stream.match(/^-?[0-9\.]/, false)) {
84
+ var floatLiteral = false;
85
+ // Floats
86
+ if (stream.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)) {
87
+ floatLiteral = true;
88
+ }
89
+ if (stream.match(/^-?\d+\.\d*/)) {
90
+ floatLiteral = true;
91
+ }
92
+ if (stream.match(/^-?\.\d+/)) {
93
+ floatLiteral = true;
94
+ }
95
+
96
+ if (floatLiteral) {
97
+ // prevent from getting extra . on 1..
98
+ if (stream.peek() == "."){
99
+ stream.backUp(1);
100
+ }
101
+ return 'number';
102
+ }
103
+ // Integers
104
+ var intLiteral = false;
105
+ // Hex
106
+ if (stream.match(/^-?0x[0-9a-f]+/i)) {
107
+ intLiteral = true;
108
+ }
109
+ // Decimal
110
+ if (stream.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)) {
111
+ intLiteral = true;
112
+ }
113
+ // Zero by itself with no other piece of number.
114
+ if (stream.match(/^-?0(?![\dx])/i)) {
115
+ intLiteral = true;
116
+ }
117
+ if (intLiteral) {
118
+ return 'number';
119
+ }
120
+ }
121
+
122
+ // Handle strings
123
+ if (stream.match(stringPrefixes)) {
124
+ state.tokenize = tokenFactory(stream.current(), 'string');
125
+ return state.tokenize(stream, state);
126
+ }
127
+ // Handle regex literals
128
+ if (stream.match(regexPrefixes)) {
129
+ if (stream.current() != '/' || stream.match(/^.*\//, false)) { // prevent highlight of division
130
+ state.tokenize = tokenFactory(stream.current(), 'string-2');
131
+ return state.tokenize(stream, state);
132
+ } else {
133
+ stream.backUp(1);
134
+ }
135
+ }
136
+
137
+ // Handle operators and delimiters
138
+ if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) {
139
+ return 'punctuation';
140
+ }
141
+ if (stream.match(doubleOperators)
142
+ || stream.match(singleOperators)
143
+ || stream.match(wordOperators)) {
144
+ return 'operator';
145
+ }
146
+ if (stream.match(singleDelimiters)) {
147
+ return 'punctuation';
148
+ }
149
+
150
+ if (stream.match(constants)) {
151
+ return 'atom';
152
+ }
153
+
154
+ if (stream.match(keywords)) {
155
+ return 'keyword';
156
+ }
157
+
158
+ if (stream.match(identifiers)) {
159
+ return 'variable';
160
+ }
161
+
162
+ if (stream.match(properties)) {
163
+ return 'property';
164
+ }
165
+
166
+ // Handle non-detected items
167
+ stream.next();
168
+ return ERRORCLASS;
169
+ }
170
+
171
+ function tokenFactory(delimiter, outclass) {
172
+ var singleline = delimiter.length == 1;
173
+ return function tokenString(stream, state) {
174
+ while (!stream.eol()) {
175
+ stream.eatWhile(/[^'"\/\\]/);
176
+ if (stream.eat('\\')) {
177
+ stream.next();
178
+ if (singleline && stream.eol()) {
179
+ return outclass;
180
+ }
181
+ } else if (stream.match(delimiter)) {
182
+ state.tokenize = tokenBase;
183
+ return outclass;
184
+ } else {
185
+ stream.eat(/['"\/]/);
186
+ }
187
+ }
188
+ if (singleline) {
189
+ if (conf.mode.singleLineStringErrors) {
190
+ outclass = ERRORCLASS;
191
+ } else {
192
+ state.tokenize = tokenBase;
193
+ }
194
+ }
195
+ return outclass;
196
+ };
197
+ }
198
+
199
+ function longComment(stream, state) {
200
+ while (!stream.eol()) {
201
+ stream.eatWhile(/[^#]/);
202
+ if (stream.match("###")) {
203
+ state.tokenize = tokenBase;
204
+ break;
205
+ }
206
+ stream.eatWhile("#");
207
+ }
208
+ return "comment";
209
+ }
210
+
211
+ function indent(stream, state, type) {
212
+ type = type || 'coffee';
213
+ var indentUnit = 0;
214
+ if (type === 'coffee') {
215
+ for (var i = 0; i < state.scopes.length; i++) {
216
+ if (state.scopes[i].type === 'coffee') {
217
+ indentUnit = state.scopes[i].offset + conf.indentUnit;
218
+ break;
219
+ }
220
+ }
221
+ } else {
222
+ indentUnit = stream.column() + stream.current().length;
223
+ }
224
+ state.scopes.unshift({
225
+ offset: indentUnit,
226
+ type: type
227
+ });
228
+ }
229
+
230
+ function dedent(stream, state) {
231
+ if (state.scopes.length == 1) return;
232
+ if (state.scopes[0].type === 'coffee') {
233
+ var _indent = stream.indentation();
234
+ var _indent_index = -1;
235
+ for (var i = 0; i < state.scopes.length; ++i) {
236
+ if (_indent === state.scopes[i].offset) {
237
+ _indent_index = i;
238
+ break;
239
+ }
240
+ }
241
+ if (_indent_index === -1) {
242
+ return true;
243
+ }
244
+ while (state.scopes[0].offset !== _indent) {
245
+ state.scopes.shift();
246
+ }
247
+ return false;
248
+ } else {
249
+ state.scopes.shift();
250
+ return false;
251
+ }
252
+ }
253
+
254
+ function tokenLexer(stream, state) {
255
+ var style = state.tokenize(stream, state);
256
+ var current = stream.current();
257
+
258
+ // Handle '.' connected identifiers
259
+ if (current === '.') {
260
+ style = state.tokenize(stream, state);
261
+ current = stream.current();
262
+ if (style === 'variable') {
263
+ return 'variable';
264
+ } else {
265
+ return ERRORCLASS;
266
+ }
267
+ }
268
+
269
+ // Handle scope changes.
270
+ if (current === 'return') {
271
+ state.dedent += 1;
272
+ }
273
+ if (((current === '->' || current === '=>') &&
274
+ !state.lambda &&
275
+ state.scopes[0].type == 'coffee' &&
276
+ stream.peek() === '')
277
+ || style === 'indent') {
278
+ indent(stream, state);
279
+ }
280
+ var delimiter_index = '[({'.indexOf(current);
281
+ if (delimiter_index !== -1) {
282
+ indent(stream, state, '])}'.slice(delimiter_index, delimiter_index+1));
283
+ }
284
+ if (indentKeywords.exec(current)){
285
+ indent(stream, state);
286
+ }
287
+ if (current == 'then'){
288
+ dedent(stream, state);
289
+ }
290
+
291
+
292
+ if (style === 'dedent') {
293
+ if (dedent(stream, state)) {
294
+ return ERRORCLASS;
295
+ }
296
+ }
297
+ delimiter_index = '])}'.indexOf(current);
298
+ if (delimiter_index !== -1) {
299
+ if (dedent(stream, state)) {
300
+ return ERRORCLASS;
301
+ }
302
+ }
303
+ if (state.dedent > 0 && stream.eol() && state.scopes[0].type == 'coffee') {
304
+ if (state.scopes.length > 1) state.scopes.shift();
305
+ state.dedent -= 1;
306
+ }
307
+
308
+ return style;
309
+ }
310
+
311
+ var external = {
312
+ startState: function(basecolumn) {
313
+ return {
314
+ tokenize: tokenBase,
315
+ scopes: [{offset:basecolumn || 0, type:'coffee'}],
316
+ lastToken: null,
317
+ lambda: false,
318
+ dedent: 0
319
+ };
320
+ },
321
+
322
+ token: function(stream, state) {
323
+ var style = tokenLexer(stream, state);
324
+
325
+ state.lastToken = {style:style, content: stream.current()};
326
+
327
+ if (stream.eol() && stream.lambda) {
328
+ state.lambda = false;
329
+ }
330
+
331
+ return style;
332
+ },
333
+
334
+ indent: function(state) {
335
+ if (state.tokenize != tokenBase) {
336
+ return 0;
337
+ }
338
+
339
+ return state.scopes[0].offset;
340
+ }
341
+
342
+ };
343
+ return external;
344
+ });
345
+
346
+ CodeMirror.defineMIME('text/x-coffeescript', 'coffeescript');