tagz 0.0.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. data/README +240 -0
  2. data/README.tmpl +240 -0
  3. data/install.rb +4 -0
  4. data/lib/tagz.rb +146 -351
  5. data/test/tagz.rb +226 -191
  6. metadata +3 -106
  7. data/lib/tagz/rails.rb +0 -198
  8. data/rails/README +0 -182
  9. data/rails/Rakefile +0 -10
  10. data/rails/app/controllers/application.rb +0 -7
  11. data/rails/app/controllers/tagz_controller.rb +0 -51
  12. data/rails/app/helpers/application_helper.rb +0 -3
  13. data/rails/app/helpers/tagz_helper.rb +0 -2
  14. data/rails/app/views/layouts/layout.rb +0 -16
  15. data/rails/app/views/tagz/b.rb +0 -19
  16. data/rails/app/views/tagz/c.rb +0 -9
  17. data/rails/app/views/tagz/d.rhtml +0 -17
  18. data/rails/app/views/tagz/e.rb +0 -3
  19. data/rails/config/boot.rb +0 -45
  20. data/rails/config/database.yml +0 -36
  21. data/rails/config/environment.rb +0 -65
  22. data/rails/config/environments/development.rb +0 -21
  23. data/rails/config/environments/production.rb +0 -18
  24. data/rails/config/environments/test.rb +0 -19
  25. data/rails/config/lighttpd.conf +0 -54
  26. data/rails/config/routes.rb +0 -23
  27. data/rails/doc/README_FOR_APP +0 -2
  28. data/rails/log/development.log +0 -6713
  29. data/rails/log/fastcgi.crash.log +0 -103
  30. data/rails/log/lighttpd.access.log +0 -171
  31. data/rails/log/lighttpd.error.log +0 -116
  32. data/rails/log/production.log +0 -0
  33. data/rails/log/server.log +0 -0
  34. data/rails/log/test.log +0 -0
  35. data/rails/public/404.html +0 -30
  36. data/rails/public/500.html +0 -30
  37. data/rails/public/dispatch.cgi +0 -10
  38. data/rails/public/dispatch.fcgi +0 -24
  39. data/rails/public/dispatch.rb +0 -10
  40. data/rails/public/favicon.ico +0 -0
  41. data/rails/public/images/rails.png +0 -0
  42. data/rails/public/index.html +0 -277
  43. data/rails/public/javascripts/application.js +0 -2
  44. data/rails/public/javascripts/controls.js +0 -833
  45. data/rails/public/javascripts/dragdrop.js +0 -942
  46. data/rails/public/javascripts/effects.js +0 -1088
  47. data/rails/public/javascripts/prototype.js +0 -2515
  48. data/rails/public/robots.txt +0 -1
  49. data/rails/script/about +0 -3
  50. data/rails/script/breakpointer +0 -3
  51. data/rails/script/console +0 -3
  52. data/rails/script/destroy +0 -3
  53. data/rails/script/generate +0 -3
  54. data/rails/script/performance/benchmarker +0 -3
  55. data/rails/script/performance/profiler +0 -3
  56. data/rails/script/plugin +0 -3
  57. data/rails/script/process/inspector +0 -3
  58. data/rails/script/process/reaper +0 -3
  59. data/rails/script/process/spawner +0 -3
  60. data/rails/script/runner +0 -3
  61. data/rails/script/server +0 -4
  62. data/rails/test/functional/tagz_controller_test.rb +0 -18
  63. data/rails/test/test_helper.rb +0 -28
  64. data/rails/tmp/cache/index.html-gzip-1958902-7552-1181801882 +0 -0
  65. data/rails/tmp/cache/javascripts/effects.js-gzip-1958907-38200-1181801882 +0 -0
  66. data/rails/tmp/cache/javascripts/prototype.js-gzip-1958906-71260-1181801882 +0 -0
  67. data/rails/tmp/sessions/ruby_sess.365e696810aa7418 +0 -0
  68. data/rails/tmp/sessions/ruby_sess.3ab0cb2f589d3855 +0 -0
  69. data/rails/tmp/sessions/ruby_sess.c812e68d96a6e99f +0 -0
  70. data/rails/tmp/sessions/ruby_sess.e0a954440a7e27d7 +0 -0
@@ -7,145 +7,170 @@ require 'tagz'
7
7
 
8
8
  class TagzTest < Test::Unit::TestCase
9
9
  include Tagz
10
- def test_000 #--{{{
10
+
11
+ class ::String
12
+ Equal = instance_method '=='
13
+ remove_method '=='
14
+ def == other
15
+ Equal.bind(self.delete(' ')).call other.to_s.delete(' ')
16
+ end
17
+ end
18
+
19
+ def test_000
11
20
  expected = '<foo ></foo>'
12
- actual = (
21
+ actual = tagz{
13
22
  foo_
14
23
  _foo
15
- )
24
+ }
16
25
  assert_equal expected, actual
17
- end #--}}}
18
- def test_010 #--{{{
26
+ end
27
+
28
+ def test_010
19
29
  expected = '<foo ><bar ></bar></foo>'
20
- actual = (
30
+ actual = tagz{
21
31
  foo_
22
32
  bar_
23
33
  _bar
24
34
  _foo
25
- )
35
+ }
26
36
  assert_equal expected, actual
27
- end #--}}}
28
- def test_020 #--{{{
29
- expected = '<foo ><bar ></bar></foo>'
30
- actual = (
37
+ end
38
+
39
+ def test_020
40
+ expected = '<foo ><bar /></foo>'
41
+ actual = tagz{
31
42
  foo_
32
43
  bar_{}
33
44
  _foo
34
- )
45
+ }
35
46
  assert_equal expected, actual
36
- end #--}}}
37
- def test_030 #--{{{
38
- expected = '<foo ><bar ></bar></foo>'
39
- actual = (
47
+ end
48
+
49
+ def test_030
50
+ expected = '<foo ><bar /></foo>'
51
+ actual = tagz{
40
52
  foo_{
41
53
  bar_{}
42
54
  }
43
- )
55
+ }
44
56
  assert_equal expected, actual
45
- end #--}}}
46
- def test_040 #--{{{
57
+ end
58
+
59
+ def test_040
47
60
  expected = '<foo >bar</foo>'
48
- actual = (
61
+ actual = tagz{
49
62
  foo_{ 'bar' }
50
- )
63
+ }
51
64
  assert_equal expected, actual
52
- end #--}}}
53
- def test_050 #--{{{
65
+ end
66
+
67
+ def test_050
54
68
  expected = '<foo ><bar >foobar</bar></foo>'
55
- actual = (
69
+ actual = tagz{
56
70
  foo_{
57
71
  bar_{ 'foobar' }
58
72
  }
59
- )
73
+ }
60
74
  assert_equal expected, actual
61
- end #--}}}
62
- def test_060 #--{{{
75
+ end
76
+
77
+ def test_060
63
78
  expected = '<foo key="value" ><bar a="b" >foobar</bar></foo>'
64
- actual = (
79
+ actual = tagz{
65
80
  foo_('key' => 'value'){
66
81
  bar_(:a => :b){ 'foobar' }
67
82
  }
68
- )
83
+ }
69
84
  assert_equal expected, actual
70
- end #--}}}
71
- def test_070 #--{{{
72
- expected = '<foo ></foo><bar ></bar>'
73
- actual = (
85
+ end
86
+
87
+ def test_070
88
+ expected = '<foo /><bar />'
89
+ actual = tagz{
74
90
  foo_{} + bar_{}
75
- )
91
+ }
76
92
  assert_equal expected, actual
77
- end #--}}}
78
- def test_080 #--{{{
93
+ end
94
+
95
+ =begin
96
+ def test_080
79
97
  assert_raises(Tagz::NotOpen) do
80
98
  foo_{ _bar }
81
99
  end
82
- end #--}}}
83
- def test_090 #--{{{
100
+ end
101
+ def test_090
84
102
  assert_raises(Tagz::NotOpen) do
85
103
  _foo
86
104
  end
87
- end #--}}}
88
- def test_100 #--{{{
105
+ end
106
+ def test_100
89
107
  assert_nothing_raised do
90
108
  foo_
91
109
  _foo
92
110
  end
93
- end #--}}}
94
- def test_110 #--{{{
111
+ end
112
+ =end
113
+
114
+ def test_110
95
115
  expected = '<foo ><bar >foobar</bar></foo>'
96
- actual = (
116
+ actual = tagz{
97
117
  foo_{
98
118
  bar_{ 'foobar' }
99
- 'this content is ignored'
119
+ 'this content is ignored because the block added content'
100
120
  }
101
- )
121
+ }
102
122
  assert_equal expected, actual
103
- end #--}}}
104
- def test_120 #--{{{
123
+ end
124
+
125
+ def test_120
105
126
  expected = '<foo ><bar >foobar</bar><baz >barfoo</baz></foo>'
106
- actual = (
127
+ actual = tagz{
107
128
  foo_{
108
129
  bar_{ 'foobar' }
109
130
  baz_{ 'barfoo' }
110
131
  }
111
- )
132
+ }
112
133
  assert_equal expected, actual
113
- end #--}}}
114
- def test_121 #--{{{
134
+ end
135
+
136
+ def test_121
115
137
  expected = '<foo ><bar >foobar</bar><baz >barfoo</baz></foo>'
116
- actual = (
138
+ actual = tagz{
117
139
  foo_{
118
140
  bar_{ 'foobar' }
119
141
  baz_{ 'barfoo' }
120
142
  }
121
- )
143
+ }
122
144
  assert_equal expected, actual
123
- end #--}}}
124
- def test_130 #--{{{
145
+ end
146
+
147
+ def test_130
125
148
  expected = '<foo >a<bar >foobar</bar>b<baz >barfoo</baz></foo>'
126
- actual = (
127
- foo_{ |tag|
128
- tag << 'a'
149
+ actual = tagz{
150
+ foo_{ |t|
151
+ t << 'a'
129
152
  bar_{ 'foobar' }
130
- tag << 'b'
153
+ t << 'b'
131
154
  baz_{ 'barfoo' }
132
155
  }
133
- )
156
+ }
134
157
  assert_equal expected, actual
135
- end #--}}}
136
- def test_140 #--{{{
158
+ end
159
+
160
+ def test_140
137
161
  expected = '<foo ><bar >baz</bar></foo>'
138
- actual = (
162
+ actual = tagz{
139
163
  foo_{
140
164
  bar_ << 'baz'
141
165
  _bar
142
166
  }
143
- )
167
+ }
144
168
  assert_equal expected, actual
145
- end #--}}}
146
- def test_150 #--{{{
169
+ end
170
+
171
+ def test_150
147
172
  expected = '<foo ><bar >bar<baz >baz</baz></bar></foo>'
148
- actual = (
173
+ actual = tagz{
149
174
  foo_{
150
175
  bar_ << 'bar'
151
176
  tag = baz_
@@ -153,25 +178,27 @@ class TagzTest < Test::Unit::TestCase
153
178
  _baz
154
179
  _bar
155
180
  }
156
- )
181
+ }
157
182
  assert_equal expected, actual
158
- end #--}}}
159
- def test_160 #--{{{
183
+ end
184
+
185
+ def test_160
160
186
  expected = '<foo >a<bar >b</bar></foo>'
161
- actual = (
187
+ actual = tagz{
162
188
  foo_{ |foo|
163
189
  foo << 'a'
164
190
  bar_{ |bar|
165
191
  bar << 'b'
166
192
  }
167
193
  }
168
- )
194
+ }
169
195
  assert_equal expected, actual
170
- end #--}}}
171
- def test_170 #--{{{
196
+ end
197
+
198
+ def test_170
172
199
  expected = '<html ><body ><ul ><li >a</li><li >b</li><li >c</li></ul></body></html>'
173
200
  @list = %w( a b c )
174
- actual = (
201
+ actual = tagz{
175
202
  html_{
176
203
  body_{
177
204
  ul_{
@@ -179,112 +206,124 @@ class TagzTest < Test::Unit::TestCase
179
206
  }
180
207
  }
181
208
  }
182
- )
209
+ }
183
210
  assert_equal expected, actual
184
- end #--}}}
185
- def test_180 #--{{{
211
+ end
212
+
213
+ def test_180
186
214
  expected = '<html ><body >42</body></html>'
187
- actual = (
215
+ actual = tagz{
188
216
  html_{
189
217
  b = body_
190
218
  b << 42
191
219
  _body
192
220
  }
193
- )
221
+ }
194
222
  assert_equal expected, actual
195
- end #--}}}
196
- def test_190 #--{{{
223
+ end
224
+
225
+ def test_190
197
226
  expected = '<html ><body >42</body></html>'
198
- actual = (
227
+ actual = tagz{
199
228
  html_{
200
229
  body_
201
230
  tagz << 42 ### tagz is always the current tag!
202
231
  _body
203
232
  }
204
- )
233
+ }
205
234
  assert_equal expected, actual
206
- end #--}}}
207
- def test_200 #--{{{
235
+ end
236
+
237
+ def test_200
208
238
  expected = '<html ><body >42</body></html>'
209
- actual = (
239
+ actual = tagz{
210
240
  html_{
211
241
  body_{
212
242
  tagz << 42 ### tagz is always the current tag!
213
243
  }
214
244
  }
215
- )
245
+ }
216
246
  assert_equal expected, actual
217
- end #--}}}
218
- def test_210 #--{{{
247
+ end
248
+
249
+ def test_210
219
250
  expected = '<html ><body >42</body></html>'
220
- actual = (
251
+ actual = tagz{
221
252
  html_{
222
253
  body_{ |body|
223
254
  body << 42
224
255
  }
225
256
  }
226
- )
257
+ }
227
258
  assert_equal expected, actual
228
- end #--}}}
229
- def test_220 #--{{{
259
+ end
260
+
261
+ =begin
262
+ def test_220
230
263
  expected = '<html ><body >42</body></html>'
231
- actual = (
264
+ actual = tagz{
232
265
  'html'.tag do
233
266
  'body'.tag do
234
267
  42
235
268
  end
236
269
  end
237
- )
270
+ }
238
271
  assert_equal expected, actual
239
- end #--}}}
240
- def test_230 #--{{{
272
+ end
273
+ =end
274
+
275
+ def test_230
241
276
  expected = '<html ><body ><div k="v" >content</div></body></html>'
242
- actual = (
277
+ actual = tagz{
243
278
  html_{
244
279
  body_{
245
- div_('k="v"'){ "content" }
280
+ div_(:k => :v){ "content" }
246
281
  }
247
282
  }
248
- )
283
+ }
249
284
  assert_equal expected, actual
250
- end #--}}}
251
- def test_240 #--{{{
252
- expected = '<html ><body ><div k="v" >content</body></html>'
253
- actual = (
285
+ end
286
+
287
+ def test_240
288
+ expected = '<html ><body ><div k="v" >content</div></body></html>'
289
+ actual = tagz{
254
290
  html_{
255
291
  body_{
256
292
  div_ "content", :k => :v
257
293
  }
258
294
  }
259
- )
295
+ }
260
296
  assert_equal expected, actual
261
- end #--}}}
262
- def test_241 #--{{{
263
- expected = '<html ><body ><div k="v" >content</div></body></html>'
264
- actual = (
297
+ end
298
+
299
+ def test_241
300
+ expected = '<html ><body ><div k="v" >content</div></div></body></html>'
301
+ actual = tagz{
265
302
  html_{
266
303
  body_{
267
304
  div_ "content", :k => :v
268
305
  _div
269
306
  }
270
307
  }
271
- )
308
+ }
272
309
  assert_equal expected, actual
273
- end #--}}}
274
- def test_250 #--{{{
310
+ end
311
+
312
+ def test_250
275
313
  expected = '<html ><body ><div k="v" >content and more content</div></body></html>'
276
- actual = (
314
+ actual = tagz{
277
315
  html_{
278
316
  body_{
279
- div_('k="v"', "content"){ ' and more content' }
317
+ div_("content", :k => :v){ ' and more content' }
280
318
  }
281
319
  }
282
- )
320
+ }
283
321
  assert_equal expected, actual
284
- end #--}}}
285
- def test_260 #--{{{
322
+ end
323
+
324
+ def test_260
286
325
  expected = '<html ><body ><div k="v" >content</div></body></html>'
287
- actual = (
326
+ actual = tagz{
288
327
  html_{
289
328
  body_{
290
329
  div_ :k => :v
@@ -292,12 +331,13 @@ class TagzTest < Test::Unit::TestCase
292
331
  _div
293
332
  }
294
333
  }
295
- )
334
+ }
296
335
  assert_equal expected, actual
297
- end #--}}}
298
- def test_270 #--{{{
336
+ end
337
+
338
+ def test_270
299
339
  expected = '<html ><body ><div k="v" >content</div></body></html>'
300
- actual = (
340
+ actual = tagz{
301
341
  html_{
302
342
  body_{
303
343
  div_ :k => :v
@@ -305,131 +345,126 @@ class TagzTest < Test::Unit::TestCase
305
345
  _div
306
346
  }
307
347
  }
308
- )
309
- assert_equal expected, actual
310
- end #--}}}
311
- def test_280 #--{{{
312
- expected = '<html ><body ><div k="v" >content</div></body></html>'
313
- actual = (
314
- html_{
315
- body_{
316
- div_ :k => :v
317
- __{ "content" }
318
- _div
319
- }
320
- }
321
- )
348
+ }
322
349
  assert_equal expected, actual
323
- end #--}}}
324
- def test_280 #--{{{
325
- expected = 'content'
326
- actual = (
327
- __{ "content" }
328
- )
329
- assert_equal expected, actual
330
- end #--}}}
331
- def test_280 #--{{{
350
+ end
351
+
352
+ def test_280
332
353
  expected = 'content'
333
- actual = (
354
+ actual = tagz{
334
355
  tagz << "content"
335
- )
356
+ }
336
357
  assert_equal expected, actual
337
- end #--}}}
338
- def test_290 #--{{{
358
+ end
359
+
360
+ def test_290
339
361
  expected = 'foobar'
340
- actual = (
362
+ actual = tagz{
341
363
  tagz {
342
364
  tagz << 'foo' << 'bar'
343
365
  }
344
- )
366
+ }
345
367
  assert_equal expected, actual
346
- end #--}}}
347
- def test_300 #--{{{
368
+ end
369
+
370
+ =begin
371
+ def test_300
348
372
  expected = 'foobar'
349
- actual = (
373
+ actual = tagz{
350
374
  tagz{ tagz 'foo', 'bar' }
351
- )
375
+ }
352
376
  assert_equal expected, actual
353
- end #--}}}
354
- def test_310 #--{{{
377
+ end
378
+ =end
379
+
380
+ def test_310
355
381
  expected = '<html ><body ><div k="v" >foobar</div></body></html>'
356
- actual = (
382
+ actual = tagz{
357
383
  html_{
358
384
  body_{
359
385
  div_! "foo", "bar", :k => :v
360
386
  }
361
387
  }
362
- )
388
+ }
363
389
  assert_equal expected, actual
364
- end #--}}}
365
- def test_320 #--{{{
390
+ end
391
+
392
+ def test_320
366
393
  expected = '<html ><body ><a href="a" >a</a><span >|</span><a href="b" >b</a><span >|</span><a href="c" >c</a></body></html>'
367
394
  links = %w( a b c )
368
- actual = (
395
+ actual = tagz{
369
396
  html_{
370
397
  body_{
371
398
  links.map{|link| e(:a, :href => link){ link }}.join e(:span){ '|' }
372
399
  }
373
400
  }
374
- )
401
+ }
375
402
  assert_equal expected, actual
376
- end #--}}}
377
- def test_330 #--{{{
403
+ end
404
+
405
+ def test_330
378
406
  expected = '<a ><b ><c >'
379
- actual = (
407
+ actual = tagz{
380
408
  tagz {
381
409
  a_
382
410
  b_
383
411
  c_
384
412
  }
385
- )
413
+ }
386
414
  assert_equal expected, actual
387
- end #--}}}
388
- def test_340 #--{{{
415
+ end
416
+
417
+ def test_340
389
418
  expected = '<a ><b ><c ></a>'
390
- actual = (
419
+ actual = tagz{
391
420
  a_ {
392
421
  b_
393
422
  c_
394
423
  }
395
- )
424
+ }
396
425
  assert_equal expected, actual
397
- end #--}}}
398
- def test_350 #--{{{
399
- expected = '<a ><b ><c >content</a>'
400
- actual = (
426
+ end
427
+
428
+ def test_350
429
+ expected = '<a ><b ><c >content</c></a>'
430
+ actual = tagz{
401
431
  a_ {
402
432
  b_
403
433
  c_ "content"
404
434
  }
405
- )
435
+ }
406
436
  assert_equal expected, actual
407
- end #--}}}
408
- def test_360 #--{{{
409
- expected = '<a ><b >content<c ><d >more content</a>'
410
- actual = (
437
+ end
438
+
439
+ def test_360
440
+ expected = '<a ><b >content</b><c ><d >more content</d></a>'
441
+ actual = tagz{
411
442
  a_ {
412
443
  b_ "content"
413
444
  c_
414
445
  d_ "more content"
415
446
  }
416
- )
447
+ }
417
448
  assert_equal expected, actual
418
- end #--}}}
419
- def test_370 #--{{{
449
+ end
450
+
451
+ =begin
452
+ def test_370
420
453
  expected = 'ab'
421
- actual = (
454
+ actual = tagz{
422
455
  re = 'a'
423
456
  re << tagz{'b'}
424
457
  re
425
- )
458
+ }
426
459
  assert_equal expected, actual
427
- end #--}}}
428
- def test_380 #--{{{
460
+ end
461
+ =end
462
+
463
+ def test_380
429
464
  expected = 'ab'
430
- actual = (
465
+ actual = tagz{
431
466
  tagz{ 'a' } + tagz{ 'b' }
432
- )
467
+ }
433
468
  assert_equal expected, actual
434
- end #--}}}
469
+ end
435
470
  end