jade 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/.gitignore +4 -0
  2. data/Gemfile +10 -0
  3. data/README.md +71 -0
  4. data/Rakefile +4 -0
  5. data/jade.gemspec +27 -0
  6. data/lib/jade.rb +4 -0
  7. data/lib/jade/compiler.rb +41 -0
  8. data/lib/jade/engine.rb +10 -0
  9. data/lib/jade/source.rb +19 -0
  10. data/lib/jade/template.rb +29 -0
  11. data/lib/jade/version.rb +3 -0
  12. data/spec/compiler_spec.rb +32 -0
  13. data/spec/dummy/.gitignore +15 -0
  14. data/spec/dummy/Gemfile +18 -0
  15. data/spec/dummy/README +261 -0
  16. data/spec/dummy/Rakefile +7 -0
  17. data/spec/dummy/app/assets/images/rails.png +0 -0
  18. data/spec/dummy/app/assets/javascripts/application.js +8 -0
  19. data/spec/dummy/app/assets/javascripts/sample.jst.jade +5 -0
  20. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  21. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  22. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  23. data/spec/dummy/app/mailers/.gitkeep +0 -0
  24. data/spec/dummy/app/models/.gitkeep +0 -0
  25. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  26. data/spec/dummy/config.ru +4 -0
  27. data/spec/dummy/config/application.rb +48 -0
  28. data/spec/dummy/config/boot.rb +6 -0
  29. data/spec/dummy/config/database.yml +25 -0
  30. data/spec/dummy/config/environment.rb +5 -0
  31. data/spec/dummy/config/environments/development.rb +30 -0
  32. data/spec/dummy/config/environments/production.rb +60 -0
  33. data/spec/dummy/config/environments/test.rb +39 -0
  34. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  35. data/spec/dummy/config/initializers/inflections.rb +10 -0
  36. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  37. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  38. data/spec/dummy/config/initializers/session_store.rb +8 -0
  39. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  40. data/spec/dummy/config/locales/en.yml +5 -0
  41. data/spec/dummy/config/routes.rb +58 -0
  42. data/spec/dummy/db/seeds.rb +7 -0
  43. data/spec/dummy/doc/README_FOR_APP +2 -0
  44. data/spec/dummy/lib/assets/.gitkeep +0 -0
  45. data/spec/dummy/lib/tasks/.gitkeep +0 -0
  46. data/spec/dummy/log/.gitkeep +0 -0
  47. data/spec/dummy/public/404.html +26 -0
  48. data/spec/dummy/public/422.html +26 -0
  49. data/spec/dummy/public/500.html +26 -0
  50. data/spec/dummy/public/favicon.ico +0 -0
  51. data/spec/dummy/public/index.html +241 -0
  52. data/spec/dummy/public/robots.txt +5 -0
  53. data/spec/dummy/script/rails +6 -0
  54. data/spec/dummy/test/fixtures/.gitkeep +0 -0
  55. data/spec/dummy/test/functional/.gitkeep +0 -0
  56. data/spec/dummy/test/integration/.gitkeep +0 -0
  57. data/spec/dummy/test/performance/browsing_test.rb +12 -0
  58. data/spec/dummy/test/test_helper.rb +13 -0
  59. data/spec/dummy/test/unit/.gitkeep +0 -0
  60. data/spec/dummy/vendor/assets/stylesheets/.gitkeep +0 -0
  61. data/spec/dummy/vendor/plugins/.gitkeep +0 -0
  62. data/spec/source_spec.rb +19 -0
  63. data/spec/spec_helper.rb +20 -0
  64. data/spec/support/global.rb +7 -0
  65. data/spec/support/matchers.rb +17 -0
  66. data/spec/template_spec.rb +29 -0
  67. data/vendor/assets/javascripts/jade/jade.js +3168 -0
  68. data/vendor/assets/javascripts/jade/runtime.js +128 -0
  69. metadata +271 -0
@@ -0,0 +1,128 @@
1
+
2
+ var jade = (function(exports){
3
+ /*!
4
+ * Jade - runtime
5
+ * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
6
+ * MIT Licensed
7
+ */
8
+
9
+ /**
10
+ * Lame Array.isArray() polyfill for now.
11
+ */
12
+
13
+ if (!Array.isArray) {
14
+ Array.isArray = function(arr){
15
+ return '[object Array]' == Object.prototype.toString.call(arr);
16
+ };
17
+ }
18
+
19
+ /**
20
+ * Lame Object.keys() polyfill for now.
21
+ */
22
+
23
+ if (!Object.keys) {
24
+ Object.keys = function(obj){
25
+ var arr = [];
26
+ for (var key in obj) {
27
+ if (obj.hasOwnProperty(key)) {
28
+ arr.push(key);
29
+ }
30
+ }
31
+ return arr;
32
+ }
33
+ }
34
+
35
+ /**
36
+ * Render the given attributes object.
37
+ *
38
+ * @param {Object} obj
39
+ * @return {String}
40
+ * @api private
41
+ */
42
+
43
+ exports.attrs = function attrs(obj){
44
+ var buf = []
45
+ , terse = obj.terse;
46
+ delete obj.terse;
47
+ var keys = Object.keys(obj)
48
+ , len = keys.length;
49
+ if (len) {
50
+ buf.push('');
51
+ for (var i = 0; i < len; ++i) {
52
+ var key = keys[i]
53
+ , val = obj[key];
54
+ if ('boolean' == typeof val || null == val) {
55
+ if (val) {
56
+ terse
57
+ ? buf.push(key)
58
+ : buf.push(key + '="' + key + '"');
59
+ }
60
+ } else if ('class' == key && Array.isArray(val)) {
61
+ buf.push(key + '="' + exports.escape(val.join(' ')) + '"');
62
+ } else {
63
+ buf.push(key + '="' + exports.escape(val) + '"');
64
+ }
65
+ }
66
+ }
67
+ return buf.join(' ');
68
+ };
69
+
70
+ /**
71
+ * Escape the given string of `html`.
72
+ *
73
+ * @param {String} html
74
+ * @return {String}
75
+ * @api private
76
+ */
77
+
78
+ exports.escape = function escape(html){
79
+ return String(html)
80
+ .replace(/&(?!\w+;)/g, '&amp;')
81
+ .replace(/</g, '&lt;')
82
+ .replace(/>/g, '&gt;')
83
+ .replace(/"/g, '&quot;');
84
+ };
85
+
86
+ /**
87
+ * Re-throw the given `err` in context to the
88
+ * the jade in `filename` at the given `lineno`.
89
+ *
90
+ * @param {Error} err
91
+ * @param {String} filename
92
+ * @param {String} lineno
93
+ * @api private
94
+ */
95
+
96
+ exports.rethrow = function rethrow(err, filename, lineno){
97
+ if (!filename) throw err;
98
+
99
+ // If we can't catch the context we still output line and file
100
+ try {
101
+ var context = 3
102
+ , str = require('fs').readFileSync(filename, 'utf8')
103
+ , lines = str.split('\n')
104
+ , start = Math.max(lineno - context, 0)
105
+ , end = Math.min(lines.length, lineno + context);
106
+
107
+ // Error context
108
+ var context = lines.slice(start, end).map(function(line, i){
109
+ var curr = i + start + 1;
110
+ return (curr == lineno ? ' > ' : ' ')
111
+ + curr
112
+ + '| '
113
+ + line;
114
+ }).join('\n') + '\n\n';
115
+ } catch(failure) {
116
+ var context = '';
117
+ }
118
+
119
+ // Alter exception message
120
+ err.path = filename;
121
+ err.message = (filename || 'Jade') + ':' + lineno
122
+ + '\n' + context + err.message;
123
+ throw err;
124
+ };
125
+
126
+ return exports;
127
+
128
+ })({});
metadata ADDED
@@ -0,0 +1,271 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jade
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Boris Staal
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-01-14 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: execjs
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: tilt
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ hash: 3
43
+ segments:
44
+ - 0
45
+ version: "0"
46
+ type: :runtime
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: sprockets
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ hash: 3
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ type: :runtime
61
+ version_requirements: *id003
62
+ - !ruby/object:Gem::Dependency
63
+ name: rspec
64
+ prerelease: false
65
+ requirement: &id004 !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ hash: 3
71
+ segments:
72
+ - 0
73
+ version: "0"
74
+ type: :development
75
+ version_requirements: *id004
76
+ - !ruby/object:Gem::Dependency
77
+ name: rails
78
+ prerelease: false
79
+ requirement: &id005 !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ hash: 5
85
+ segments:
86
+ - 3
87
+ - 1
88
+ version: "3.1"
89
+ type: :development
90
+ version_requirements: *id005
91
+ - !ruby/object:Gem::Dependency
92
+ name: pry
93
+ prerelease: false
94
+ requirement: &id006 !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ hash: 3
100
+ segments:
101
+ - 0
102
+ version: "0"
103
+ type: :development
104
+ version_requirements: *id006
105
+ description: Jade is a high performance template engine heavily influenced by Haml and implemented with JavaScript for node.
106
+ email:
107
+ - boris@roundlake.ru
108
+ executables: []
109
+
110
+ extensions: []
111
+
112
+ extra_rdoc_files: []
113
+
114
+ files:
115
+ - .gitignore
116
+ - Gemfile
117
+ - README.md
118
+ - Rakefile
119
+ - jade.gemspec
120
+ - lib/jade.rb
121
+ - lib/jade/compiler.rb
122
+ - lib/jade/engine.rb
123
+ - lib/jade/source.rb
124
+ - lib/jade/template.rb
125
+ - lib/jade/version.rb
126
+ - spec/compiler_spec.rb
127
+ - spec/dummy/.gitignore
128
+ - spec/dummy/Gemfile
129
+ - spec/dummy/README
130
+ - spec/dummy/Rakefile
131
+ - spec/dummy/app/assets/images/rails.png
132
+ - spec/dummy/app/assets/javascripts/application.js
133
+ - spec/dummy/app/assets/javascripts/sample.jst.jade
134
+ - spec/dummy/app/assets/stylesheets/application.css
135
+ - spec/dummy/app/controllers/application_controller.rb
136
+ - spec/dummy/app/helpers/application_helper.rb
137
+ - spec/dummy/app/mailers/.gitkeep
138
+ - spec/dummy/app/models/.gitkeep
139
+ - spec/dummy/app/views/layouts/application.html.erb
140
+ - spec/dummy/config.ru
141
+ - spec/dummy/config/application.rb
142
+ - spec/dummy/config/boot.rb
143
+ - spec/dummy/config/database.yml
144
+ - spec/dummy/config/environment.rb
145
+ - spec/dummy/config/environments/development.rb
146
+ - spec/dummy/config/environments/production.rb
147
+ - spec/dummy/config/environments/test.rb
148
+ - spec/dummy/config/initializers/backtrace_silencers.rb
149
+ - spec/dummy/config/initializers/inflections.rb
150
+ - spec/dummy/config/initializers/mime_types.rb
151
+ - spec/dummy/config/initializers/secret_token.rb
152
+ - spec/dummy/config/initializers/session_store.rb
153
+ - spec/dummy/config/initializers/wrap_parameters.rb
154
+ - spec/dummy/config/locales/en.yml
155
+ - spec/dummy/config/routes.rb
156
+ - spec/dummy/db/seeds.rb
157
+ - spec/dummy/doc/README_FOR_APP
158
+ - spec/dummy/lib/assets/.gitkeep
159
+ - spec/dummy/lib/tasks/.gitkeep
160
+ - spec/dummy/log/.gitkeep
161
+ - spec/dummy/public/404.html
162
+ - spec/dummy/public/422.html
163
+ - spec/dummy/public/500.html
164
+ - spec/dummy/public/favicon.ico
165
+ - spec/dummy/public/index.html
166
+ - spec/dummy/public/robots.txt
167
+ - spec/dummy/script/rails
168
+ - spec/dummy/test/fixtures/.gitkeep
169
+ - spec/dummy/test/functional/.gitkeep
170
+ - spec/dummy/test/integration/.gitkeep
171
+ - spec/dummy/test/performance/browsing_test.rb
172
+ - spec/dummy/test/test_helper.rb
173
+ - spec/dummy/test/unit/.gitkeep
174
+ - spec/dummy/vendor/assets/stylesheets/.gitkeep
175
+ - spec/dummy/vendor/plugins/.gitkeep
176
+ - spec/source_spec.rb
177
+ - spec/spec_helper.rb
178
+ - spec/support/global.rb
179
+ - spec/support/matchers.rb
180
+ - spec/template_spec.rb
181
+ - vendor/assets/javascripts/jade/jade.js
182
+ - vendor/assets/javascripts/jade/runtime.js
183
+ homepage: ""
184
+ licenses: []
185
+
186
+ post_install_message:
187
+ rdoc_options: []
188
+
189
+ require_paths:
190
+ - lib
191
+ required_ruby_version: !ruby/object:Gem::Requirement
192
+ none: false
193
+ requirements:
194
+ - - ">="
195
+ - !ruby/object:Gem::Version
196
+ hash: 3
197
+ segments:
198
+ - 0
199
+ version: "0"
200
+ required_rubygems_version: !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ hash: 3
206
+ segments:
207
+ - 0
208
+ version: "0"
209
+ requirements: []
210
+
211
+ rubyforge_project: jade
212
+ rubygems_version: 1.8.10
213
+ signing_key:
214
+ specification_version: 3
215
+ summary: Server-side Jade compiler based on Tilt
216
+ test_files:
217
+ - spec/compiler_spec.rb
218
+ - spec/dummy/.gitignore
219
+ - spec/dummy/Gemfile
220
+ - spec/dummy/README
221
+ - spec/dummy/Rakefile
222
+ - spec/dummy/app/assets/images/rails.png
223
+ - spec/dummy/app/assets/javascripts/application.js
224
+ - spec/dummy/app/assets/javascripts/sample.jst.jade
225
+ - spec/dummy/app/assets/stylesheets/application.css
226
+ - spec/dummy/app/controllers/application_controller.rb
227
+ - spec/dummy/app/helpers/application_helper.rb
228
+ - spec/dummy/app/mailers/.gitkeep
229
+ - spec/dummy/app/models/.gitkeep
230
+ - spec/dummy/app/views/layouts/application.html.erb
231
+ - spec/dummy/config.ru
232
+ - spec/dummy/config/application.rb
233
+ - spec/dummy/config/boot.rb
234
+ - spec/dummy/config/database.yml
235
+ - spec/dummy/config/environment.rb
236
+ - spec/dummy/config/environments/development.rb
237
+ - spec/dummy/config/environments/production.rb
238
+ - spec/dummy/config/environments/test.rb
239
+ - spec/dummy/config/initializers/backtrace_silencers.rb
240
+ - spec/dummy/config/initializers/inflections.rb
241
+ - spec/dummy/config/initializers/mime_types.rb
242
+ - spec/dummy/config/initializers/secret_token.rb
243
+ - spec/dummy/config/initializers/session_store.rb
244
+ - spec/dummy/config/initializers/wrap_parameters.rb
245
+ - spec/dummy/config/locales/en.yml
246
+ - spec/dummy/config/routes.rb
247
+ - spec/dummy/db/seeds.rb
248
+ - spec/dummy/doc/README_FOR_APP
249
+ - spec/dummy/lib/assets/.gitkeep
250
+ - spec/dummy/lib/tasks/.gitkeep
251
+ - spec/dummy/log/.gitkeep
252
+ - spec/dummy/public/404.html
253
+ - spec/dummy/public/422.html
254
+ - spec/dummy/public/500.html
255
+ - spec/dummy/public/favicon.ico
256
+ - spec/dummy/public/index.html
257
+ - spec/dummy/public/robots.txt
258
+ - spec/dummy/script/rails
259
+ - spec/dummy/test/fixtures/.gitkeep
260
+ - spec/dummy/test/functional/.gitkeep
261
+ - spec/dummy/test/integration/.gitkeep
262
+ - spec/dummy/test/performance/browsing_test.rb
263
+ - spec/dummy/test/test_helper.rb
264
+ - spec/dummy/test/unit/.gitkeep
265
+ - spec/dummy/vendor/assets/stylesheets/.gitkeep
266
+ - spec/dummy/vendor/plugins/.gitkeep
267
+ - spec/source_spec.rb
268
+ - spec/spec_helper.rb
269
+ - spec/support/global.rb
270
+ - spec/support/matchers.rb
271
+ - spec/template_spec.rb