markaby 0.2 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/README +189 -0
  2. data/Rakefile +15 -0
  3. data/doc/rdoc/classes/Markaby.html +192 -0
  4. data/doc/rdoc/classes/Markaby/ActionControllerHelper.html +145 -0
  5. data/doc/rdoc/classes/Markaby/ActionControllerHelper.src/M000005.html +20 -0
  6. data/doc/rdoc/classes/Markaby/Builder.html +480 -0
  7. data/doc/rdoc/classes/Markaby/Builder.src/M000008.html +44 -0
  8. data/doc/rdoc/classes/Markaby/Builder.src/M000009.html +18 -0
  9. data/doc/rdoc/classes/Markaby/Builder.src/M000010.html +19 -0
  10. data/doc/rdoc/classes/Markaby/Builder.src/M000012.html +24 -0
  11. data/doc/rdoc/classes/Markaby/Builder.src/M000013.html +18 -0
  12. data/doc/rdoc/classes/Markaby/Builder.src/M000014.html +22 -0
  13. data/doc/rdoc/classes/Markaby/Builder.src/M000015.html +38 -0
  14. data/doc/rdoc/classes/Markaby/Builder.src/M000016.html +18 -0
  15. data/doc/rdoc/classes/Markaby/Builder.src/M000017.html +18 -0
  16. data/doc/rdoc/classes/Markaby/Builder.src/M000018.html +21 -0
  17. data/doc/rdoc/classes/Markaby/Builder.src/M000019.html +24 -0
  18. data/doc/rdoc/classes/Markaby/Builder.src/M000021.html +18 -0
  19. data/doc/rdoc/classes/Markaby/CssProxy.html +177 -0
  20. data/doc/rdoc/classes/Markaby/CssProxy.src/M000006.html +19 -0
  21. data/doc/rdoc/classes/Markaby/CssProxy.src/M000007.html +33 -0
  22. data/doc/rdoc/classes/Markaby/Template.html +156 -0
  23. data/doc/rdoc/classes/Markaby/Template.src/M000022.html +18 -0
  24. data/doc/rdoc/classes/Markaby/Template.src/M000023.html +20 -0
  25. data/doc/rdoc/classes/Markaby/View.html +156 -0
  26. data/doc/rdoc/classes/Markaby/View.src/M000024.html +18 -0
  27. data/doc/rdoc/classes/Markaby/View.src/M000025.html +18 -0
  28. data/doc/rdoc/classes/Object.html +199 -0
  29. data/doc/rdoc/classes/Object.src/M000001.html +16 -0
  30. data/doc/rdoc/classes/Object.src/M000002.html +16 -0
  31. data/doc/rdoc/classes/Object.src/M000003.html +18 -0
  32. data/doc/rdoc/classes/Object.src/M000004.html +18 -0
  33. data/doc/rdoc/created.rid +1 -0
  34. data/doc/rdoc/files/CHANGELOG.html +136 -0
  35. data/doc/rdoc/files/README.html +326 -0
  36. data/doc/rdoc/files/lib/markaby/builder_rb.html +101 -0
  37. data/doc/rdoc/files/lib/markaby/cssproxy_rb.html +101 -0
  38. data/doc/rdoc/files/lib/markaby/helper_rb.html +101 -0
  39. data/doc/rdoc/files/lib/markaby/metaid_rb.html +107 -0
  40. data/doc/rdoc/files/lib/markaby/tags_rb.html +101 -0
  41. data/doc/rdoc/files/lib/markaby/template_rb.html +101 -0
  42. data/doc/rdoc/files/lib/markaby/view_rb.html +101 -0
  43. data/doc/rdoc/files/lib/markaby_rb.html +127 -0
  44. data/doc/rdoc/fr_class_index.html +33 -0
  45. data/doc/rdoc/fr_file_index.html +36 -0
  46. data/doc/rdoc/fr_method_index.html +51 -0
  47. data/doc/rdoc/index.html +24 -0
  48. data/doc/rdoc/rdoc-style.css +208 -0
  49. data/lib/markaby.rb +19 -1
  50. data/lib/markaby/builder.rb +106 -28
  51. data/lib/markaby/cssproxy.rb +9 -0
  52. data/lib/markaby/helper.rb +14 -0
  53. data/lib/markaby/tags.rb +3 -19
  54. data/setup.rb +1551 -0
  55. data/test/test_markaby.rb +53 -0
  56. data/tools/rakehelp.rb +100 -0
  57. metadata +103 -35
@@ -0,0 +1,20 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>render_markaby (Markaby::ActionControllerHelper)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre> <span class="ruby-comment cmt"># File lib/markaby/helper.rb, line 8</span>
14
+ 8: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render_markaby</span>(<span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
15
+ 9: <span class="ruby-identifier">render</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">merge</span>({
16
+ 10: <span class="ruby-identifier">:text</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Builder</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">self</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>).<span class="ruby-identifier">to_s</span>
17
+ 11: })
18
+ 12: <span class="ruby-keyword kw">end</span></pre>
19
+ </body>
20
+ </html>
@@ -0,0 +1,480 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: Markaby::Builder</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Markaby::Builder</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/markaby/builder_rb.html">
59
+ lib/markaby/builder.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ <a href="../Object.html">
69
+ Object
70
+ </a>
71
+ </td>
72
+ </tr>
73
+ </table>
74
+ </div>
75
+ <!-- banner header -->
76
+
77
+ <div id="bodyContent">
78
+
79
+
80
+
81
+ <div id="contextContent">
82
+
83
+ <div id="description">
84
+ <p>
85
+ The <a href="Builder.html">Markaby::Builder</a> class is the central gear
86
+ in the system. When using from Ruby code, this is the only class you need
87
+ to instantiate directly.
88
+ </p>
89
+ <pre>
90
+ mab = Markaby::Builder.new
91
+ mab.html do
92
+ head { title &quot;Boats.com&quot; }
93
+ body do
94
+ h1 &quot;Boats.com has great deals&quot;
95
+ ul do
96
+ li &quot;$49 for a canoe&quot;
97
+ li &quot;$39 for a raft&quot;
98
+ li &quot;$29 for a huge boot that floats and can fit 5 people&quot;
99
+ end
100
+ end
101
+ end
102
+ puts mab.to_s
103
+ </pre>
104
+
105
+ </div>
106
+
107
+
108
+ </div>
109
+
110
+ <div id="method-list">
111
+ <h3 class="section-bar">Methods</h3>
112
+
113
+ <div class="name-list">
114
+ <a href="#M000011">&lt;&lt;</a>&nbsp;&nbsp;
115
+ <a href="#M000012">capture</a>&nbsp;&nbsp;
116
+ <a href="#M000013">content_for</a>&nbsp;&nbsp;
117
+ <a href="#M000018">head</a>&nbsp;&nbsp;
118
+ <a href="#M000019">html</a>&nbsp;&nbsp;
119
+ <a href="#M000017">img</a>&nbsp;&nbsp;
120
+ <a href="#M000015">method_missing</a>&nbsp;&nbsp;
121
+ <a href="#M000008">new</a>&nbsp;&nbsp;
122
+ <a href="#M000016">p</a>&nbsp;&nbsp;
123
+ <a href="#M000014">tag!</a>&nbsp;&nbsp;
124
+ <a href="#M000010">text</a>&nbsp;&nbsp;
125
+ <a href="#M000009">to_s</a>&nbsp;&nbsp;
126
+ <a href="#M000021">xhtml_strict</a>&nbsp;&nbsp;
127
+ <a href="#M000020">xhtml_transitional</a>&nbsp;&nbsp;
128
+ </div>
129
+ </div>
130
+
131
+ </div>
132
+
133
+
134
+ <!-- if includes -->
135
+
136
+ <div id="section">
137
+
138
+
139
+
140
+
141
+
142
+ <div id="attribute-list">
143
+ <h3 class="section-bar">Attributes</h3>
144
+
145
+ <div class="name-list">
146
+ <table>
147
+ <tr class="top-aligned-row context-row">
148
+ <td class="context-item-name">output_helpers</td>
149
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
150
+ <td class="context-item-desc"></td>
151
+ </tr>
152
+ </table>
153
+ </div>
154
+ </div>
155
+
156
+
157
+
158
+ <!-- if method_list -->
159
+ <div id="methods">
160
+ <h3 class="section-bar">Public Class methods</h3>
161
+
162
+ <div id="method-M000008" class="method-detail">
163
+ <a name="M000008"></a>
164
+
165
+ <div class="method-heading">
166
+ <a href="Builder.src/M000008.html" target="Code" class="method-signature"
167
+ onclick="popupCode('Builder.src/M000008.html');return false;">
168
+ <span class="method-name">new</span><span class="method-args">(assigns = {}, helpers = nil, &amp;block)</span>
169
+ </a>
170
+ </div>
171
+
172
+ <div class="method-description">
173
+ <p>
174
+ Create a <a href="../Markaby.html">Markaby</a> builder object. Pass in a
175
+ hash of variable assignments to <tt>assigns</tt> which will be available as
176
+ instance variables inside tag construction blocks. If an object is passed
177
+ in to <tt>helpers</tt>, its methods will be available from those same
178
+ blocks.
179
+ </p>
180
+ <p>
181
+ Pass in a <tt>block</tt> to new and the block will be evaluated.
182
+ </p>
183
+ <pre>
184
+ mab = Markaby::Builder.new {
185
+ html do
186
+ body do
187
+ h1 &quot;Matching Mole&quot;
188
+ end
189
+ end
190
+ }
191
+ </pre>
192
+ </div>
193
+ </div>
194
+
195
+ <h3 class="section-bar">Public Instance methods</h3>
196
+
197
+ <div id="method-M000011" class="method-detail">
198
+ <a name="M000011"></a>
199
+
200
+ <div class="method-heading">
201
+ <span class="method-name">&lt;&lt;</span><span class="method-args">(string)</span>
202
+ </div>
203
+
204
+ <div class="method-description">
205
+ <p>
206
+ Alias for <a href="Builder.html#M000010">text</a>
207
+ </p>
208
+ </div>
209
+ </div>
210
+
211
+ <div id="method-M000012" class="method-detail">
212
+ <a name="M000012"></a>
213
+
214
+ <div class="method-heading">
215
+ <a href="Builder.src/M000012.html" target="Code" class="method-signature"
216
+ onclick="popupCode('Builder.src/M000012.html');return false;">
217
+ <span class="method-name">capture</span><span class="method-args">(&amp;block)</span>
218
+ </a>
219
+ </div>
220
+
221
+ <div class="method-description">
222
+ <p>
223
+ Captures the HTML code built inside the <tt>block</tt>. This is done by
224
+ creating a new builder object, running the block and passing back its
225
+ stream as a string.
226
+ </p>
227
+ <pre>
228
+ &gt;&gt; Markaby::Builder.new.capture { h1 &quot;TEST&quot;; h2 &quot;CAPTURE ME&quot; }
229
+ =&gt; &quot;&lt;h1&gt;TITLE&lt;/h1&gt;\n&lt;h2&gt;CAPTURE ME&lt;/h2&gt;\n&quot;
230
+ </pre>
231
+ </div>
232
+ </div>
233
+
234
+ <div id="method-M000013" class="method-detail">
235
+ <a name="M000013"></a>
236
+
237
+ <div class="method-heading">
238
+ <a href="Builder.src/M000013.html" target="Code" class="method-signature"
239
+ onclick="popupCode('Builder.src/M000013.html');return false;">
240
+ <span class="method-name">content_for</span><span class="method-args">(name, &amp;block)</span>
241
+ </a>
242
+ </div>
243
+
244
+ <div class="method-description">
245
+ <p>
246
+ Content_for will store the given block in an instance variable for later
247
+ use in another template or in the layout.
248
+ </p>
249
+ <p>
250
+ The name of the instance variable is content_for_&lt;name&gt; to stay
251
+ consistent with @content_for_layout which is used by ActionView&#8217;s
252
+ layouts.
253
+ </p>
254
+ <p>
255
+ Example:
256
+ </p>
257
+ <pre>
258
+ content_for(&quot;header&quot;) do
259
+ h1 &quot;Half Shark and Half Lion&quot;
260
+ end
261
+ </pre>
262
+ <p>
263
+ If used several times, the variable will contain all the parts
264
+ concatenated.
265
+ </p>
266
+ </div>
267
+ </div>
268
+
269
+ <div id="method-M000018" class="method-detail">
270
+ <a name="M000018"></a>
271
+
272
+ <div class="method-heading">
273
+ <a href="Builder.src/M000018.html" target="Code" class="method-signature"
274
+ onclick="popupCode('Builder.src/M000018.html');return false;">
275
+ <span class="method-name">head</span><span class="method-args">(*args, &amp;block)</span>
276
+ </a>
277
+ </div>
278
+
279
+ <div class="method-description">
280
+ <p>
281
+ Builds a head tag. Adds a <tt>meta</tt> tag inside with Content-Type set to
282
+ <tt>text/html; charset=utf-8</tt>.
283
+ </p>
284
+ </div>
285
+ </div>
286
+
287
+ <div id="method-M000019" class="method-detail">
288
+ <a name="M000019"></a>
289
+
290
+ <div class="method-heading">
291
+ <a href="Builder.src/M000019.html" target="Code" class="method-signature"
292
+ onclick="popupCode('Builder.src/M000019.html');return false;">
293
+ <span class="method-name">html</span><span class="method-args">(*args, &amp;block)</span>
294
+ </a>
295
+ </div>
296
+
297
+ <div class="method-description">
298
+ <p>
299
+ Builds an html tag. An XML 1.0 instruction and an XHTML 1.0 Transitional
300
+ doctype are prepended. Also assumes <tt>:xmlns =&gt; &quot;<a
301
+ href="http://www.w3.org/1999/xhtml">www.w3.org/1999/xhtml</a>&quot;,
302
+ &quot;xml:lang&quot; =&gt; &quot;en&quot;, :lang =&gt; &quot;en&quot;</tt>.
303
+ </p>
304
+ </div>
305
+ </div>
306
+
307
+ <div id="method-M000017" class="method-detail">
308
+ <a name="M000017"></a>
309
+
310
+ <div class="method-heading">
311
+ <a href="Builder.src/M000017.html" target="Code" class="method-signature"
312
+ onclick="popupCode('Builder.src/M000017.html');return false;">
313
+ <span class="method-name">img</span><span class="method-args">(opts = {})</span>
314
+ </a>
315
+ </div>
316
+
317
+ <div class="method-description">
318
+ <p>
319
+ Builds a image tag. Assumes <tt>:border =&gt; &#8216;0&#8217;, :alt =&gt;
320
+ &#8217;&#8217;</tt>.
321
+ </p>
322
+ </div>
323
+ </div>
324
+
325
+ <div id="method-M000015" class="method-detail">
326
+ <a name="M000015"></a>
327
+
328
+ <div class="method-heading">
329
+ <a href="Builder.src/M000015.html" target="Code" class="method-signature"
330
+ onclick="popupCode('Builder.src/M000015.html');return false;">
331
+ <span class="method-name">method_missing</span><span class="method-args">(sym, *args, &amp;block)</span>
332
+ </a>
333
+ </div>
334
+
335
+ <div class="method-description">
336
+ <p>
337
+ Create XML markup based on the name of the method <tt>sym</tt>. This method
338
+ is never invoked directly, but is called for each markup method in the
339
+ markup block.
340
+ </p>
341
+ <p>
342
+ This method is also used to intercept calls to helper methods and instance
343
+ variables. Here is the order of interception:
344
+ </p>
345
+ <ul>
346
+ <li>If <tt>sym</tt> is a recognized HTML tag, the tag is output or a <a
347
+ href="CssProxy.html">CssProxy</a> is returned if no arguments are given.
348
+
349
+ </li>
350
+ <li>If <tt>sym</tt> appears to be a self-closing tag, its block is ignored,
351
+ thus outputting a valid self-closing tag.
352
+
353
+ </li>
354
+ <li>If <tt>sym</tt> is also the name of an instance variable, the value of the
355
+ instance variable is returned.
356
+
357
+ </li>
358
+ <li>If <tt>sym</tt> is a helper method, the helper method is called and output
359
+ to the stream.
360
+
361
+ </li>
362
+ <li>Otherwise, <tt>sym</tt> and its arguments are passed to tag!
363
+
364
+ </li>
365
+ </ul>
366
+ </div>
367
+ </div>
368
+
369
+ <div id="method-M000016" class="method-detail">
370
+ <a name="M000016"></a>
371
+
372
+ <div class="method-heading">
373
+ <a href="Builder.src/M000016.html" target="Code" class="method-signature"
374
+ onclick="popupCode('Builder.src/M000016.html');return false;">
375
+ <span class="method-name">p</span><span class="method-args">(*args, &amp;block)</span>
376
+ </a>
377
+ </div>
378
+
379
+ <div class="method-description">
380
+ </div>
381
+ </div>
382
+
383
+ <div id="method-M000014" class="method-detail">
384
+ <a name="M000014"></a>
385
+
386
+ <div class="method-heading">
387
+ <a href="Builder.src/M000014.html" target="Code" class="method-signature"
388
+ onclick="popupCode('Builder.src/M000014.html');return false;">
389
+ <span class="method-name">tag!</span><span class="method-args">(tag, *args, &amp;block)</span>
390
+ </a>
391
+ </div>
392
+
393
+ <div class="method-description">
394
+ <p>
395
+ Create a tag named <tt>tag</tt>. Other than the first argument which is the
396
+ tag name, the arguments are the same as the tags implemented via <a
397
+ href="Builder.html#M000015">method_missing</a>.
398
+ </p>
399
+ </div>
400
+ </div>
401
+
402
+ <div id="method-M000010" class="method-detail">
403
+ <a name="M000010"></a>
404
+
405
+ <div class="method-heading">
406
+ <a href="Builder.src/M000010.html" target="Code" class="method-signature"
407
+ onclick="popupCode('Builder.src/M000010.html');return false;">
408
+ <span class="method-name">text</span><span class="method-args">(string)</span>
409
+ </a>
410
+ </div>
411
+
412
+ <div class="method-description">
413
+ <p>
414
+ Write a <tt>string</tt> to the HTML stream without escaping it.
415
+ </p>
416
+ </div>
417
+ </div>
418
+
419
+ <div id="method-M000009" class="method-detail">
420
+ <a name="M000009"></a>
421
+
422
+ <div class="method-heading">
423
+ <a href="Builder.src/M000009.html" target="Code" class="method-signature"
424
+ onclick="popupCode('Builder.src/M000009.html');return false;">
425
+ <span class="method-name">to_s</span><span class="method-args">()</span>
426
+ </a>
427
+ </div>
428
+
429
+ <div class="method-description">
430
+ <p>
431
+ Returns a string containing the HTML stream. Internally, the stream is
432
+ stored as an Array.
433
+ </p>
434
+ </div>
435
+ </div>
436
+
437
+ <div id="method-M000021" class="method-detail">
438
+ <a name="M000021"></a>
439
+
440
+ <div class="method-heading">
441
+ <a href="Builder.src/M000021.html" target="Code" class="method-signature"
442
+ onclick="popupCode('Builder.src/M000021.html');return false;">
443
+ <span class="method-name">xhtml_strict</span><span class="method-args">(&amp;block)</span>
444
+ </a>
445
+ </div>
446
+
447
+ <div class="method-description">
448
+ <p>
449
+ Builds an html tag with XHTML 1.0 Strict doctype instead.
450
+ </p>
451
+ </div>
452
+ </div>
453
+
454
+ <div id="method-M000020" class="method-detail">
455
+ <a name="M000020"></a>
456
+
457
+ <div class="method-heading">
458
+ <span class="method-name">xhtml_transitional</span><span class="method-args">(*args, &amp;block)</span>
459
+ </div>
460
+
461
+ <div class="method-description">
462
+ <p>
463
+ Alias for <a href="Builder.html#M000019">html</a>
464
+ </p>
465
+ </div>
466
+ </div>
467
+
468
+
469
+ </div>
470
+
471
+
472
+ </div>
473
+
474
+
475
+ <div id="validator-badges">
476
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
477
+ </div>
478
+
479
+ </body>
480
+ </html>