markaby 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/markaby.rb +2 -2
- data/lib/markaby/builder.rb +57 -33
- data/lib/markaby/tags.rb +1 -0
- data/test/test_markaby.rb +21 -16
- metadata +4 -63
- data/doc/rdoc/classes/Markaby.html +0 -192
- data/doc/rdoc/classes/Markaby/ActionControllerHelper.html +0 -145
- data/doc/rdoc/classes/Markaby/ActionControllerHelper.src/M000005.html +0 -20
- data/doc/rdoc/classes/Markaby/Builder.html +0 -480
- data/doc/rdoc/classes/Markaby/Builder.src/M000008.html +0 -44
- data/doc/rdoc/classes/Markaby/Builder.src/M000009.html +0 -18
- data/doc/rdoc/classes/Markaby/Builder.src/M000010.html +0 -19
- data/doc/rdoc/classes/Markaby/Builder.src/M000012.html +0 -24
- data/doc/rdoc/classes/Markaby/Builder.src/M000013.html +0 -18
- data/doc/rdoc/classes/Markaby/Builder.src/M000014.html +0 -22
- data/doc/rdoc/classes/Markaby/Builder.src/M000015.html +0 -38
- data/doc/rdoc/classes/Markaby/Builder.src/M000016.html +0 -18
- data/doc/rdoc/classes/Markaby/Builder.src/M000017.html +0 -18
- data/doc/rdoc/classes/Markaby/Builder.src/M000018.html +0 -21
- data/doc/rdoc/classes/Markaby/Builder.src/M000019.html +0 -24
- data/doc/rdoc/classes/Markaby/Builder.src/M000021.html +0 -18
- data/doc/rdoc/classes/Markaby/CssProxy.html +0 -177
- data/doc/rdoc/classes/Markaby/CssProxy.src/M000006.html +0 -19
- data/doc/rdoc/classes/Markaby/CssProxy.src/M000007.html +0 -33
- data/doc/rdoc/classes/Markaby/Template.html +0 -156
- data/doc/rdoc/classes/Markaby/Template.src/M000022.html +0 -18
- data/doc/rdoc/classes/Markaby/Template.src/M000023.html +0 -20
- data/doc/rdoc/classes/Markaby/View.html +0 -156
- data/doc/rdoc/classes/Markaby/View.src/M000024.html +0 -18
- data/doc/rdoc/classes/Markaby/View.src/M000025.html +0 -18
- data/doc/rdoc/classes/Object.html +0 -199
- data/doc/rdoc/classes/Object.src/M000001.html +0 -16
- data/doc/rdoc/classes/Object.src/M000002.html +0 -16
- data/doc/rdoc/classes/Object.src/M000003.html +0 -18
- data/doc/rdoc/classes/Object.src/M000004.html +0 -18
- data/doc/rdoc/created.rid +0 -1
- data/doc/rdoc/files/CHANGELOG.html +0 -136
- data/doc/rdoc/files/README.html +0 -326
- data/doc/rdoc/files/lib/markaby/builder_rb.html +0 -101
- data/doc/rdoc/files/lib/markaby/cssproxy_rb.html +0 -101
- data/doc/rdoc/files/lib/markaby/helper_rb.html +0 -101
- data/doc/rdoc/files/lib/markaby/metaid_rb.html +0 -107
- data/doc/rdoc/files/lib/markaby/tags_rb.html +0 -101
- data/doc/rdoc/files/lib/markaby/template_rb.html +0 -101
- data/doc/rdoc/files/lib/markaby/view_rb.html +0 -101
- data/doc/rdoc/files/lib/markaby_rb.html +0 -127
- data/doc/rdoc/fr_class_index.html +0 -33
- data/doc/rdoc/fr_file_index.html +0 -36
- data/doc/rdoc/fr_method_index.html +0 -51
- data/doc/rdoc/index.html +0 -24
- data/doc/rdoc/rdoc-style.css +0 -208
- data/test/example.rb +0 -48
@@ -1,199 +0,0 @@
|
|
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: Object</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">Object</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../files/lib/markaby/metaid_rb.html">
|
59
|
-
lib/markaby/metaid.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
|
-
metaprogramming assistant — metaid.rb
|
86
|
-
</p>
|
87
|
-
|
88
|
-
</div>
|
89
|
-
|
90
|
-
|
91
|
-
</div>
|
92
|
-
|
93
|
-
<div id="method-list">
|
94
|
-
<h3 class="section-bar">Methods</h3>
|
95
|
-
|
96
|
-
<div class="name-list">
|
97
|
-
<a href="#M000004">class_def</a>
|
98
|
-
<a href="#M000003">meta_def</a>
|
99
|
-
<a href="#M000002">meta_eval</a>
|
100
|
-
<a href="#M000001">metaclass</a>
|
101
|
-
</div>
|
102
|
-
</div>
|
103
|
-
|
104
|
-
</div>
|
105
|
-
|
106
|
-
|
107
|
-
<!-- if includes -->
|
108
|
-
|
109
|
-
<div id="section">
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
<!-- if method_list -->
|
119
|
-
<div id="methods">
|
120
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
121
|
-
|
122
|
-
<div id="method-M000004" class="method-detail">
|
123
|
-
<a name="M000004"></a>
|
124
|
-
|
125
|
-
<div class="method-heading">
|
126
|
-
<a href="Object.src/M000004.html" target="Code" class="method-signature"
|
127
|
-
onclick="popupCode('Object.src/M000004.html');return false;">
|
128
|
-
<span class="method-name">class_def</span><span class="method-args">(name, &blk)</span>
|
129
|
-
</a>
|
130
|
-
</div>
|
131
|
-
|
132
|
-
<div class="method-description">
|
133
|
-
<p>
|
134
|
-
Defines an instance method within a class
|
135
|
-
</p>
|
136
|
-
</div>
|
137
|
-
</div>
|
138
|
-
|
139
|
-
<div id="method-M000003" class="method-detail">
|
140
|
-
<a name="M000003"></a>
|
141
|
-
|
142
|
-
<div class="method-heading">
|
143
|
-
<a href="Object.src/M000003.html" target="Code" class="method-signature"
|
144
|
-
onclick="popupCode('Object.src/M000003.html');return false;">
|
145
|
-
<span class="method-name">meta_def</span><span class="method-args">(name, &blk)</span>
|
146
|
-
</a>
|
147
|
-
</div>
|
148
|
-
|
149
|
-
<div class="method-description">
|
150
|
-
<p>
|
151
|
-
Adds methods to a metaclass
|
152
|
-
</p>
|
153
|
-
</div>
|
154
|
-
</div>
|
155
|
-
|
156
|
-
<div id="method-M000002" class="method-detail">
|
157
|
-
<a name="M000002"></a>
|
158
|
-
|
159
|
-
<div class="method-heading">
|
160
|
-
<a href="Object.src/M000002.html" target="Code" class="method-signature"
|
161
|
-
onclick="popupCode('Object.src/M000002.html');return false;">
|
162
|
-
<span class="method-name">meta_eval</span><span class="method-args">(&blk;)</span>
|
163
|
-
</a>
|
164
|
-
</div>
|
165
|
-
|
166
|
-
<div class="method-description">
|
167
|
-
</div>
|
168
|
-
</div>
|
169
|
-
|
170
|
-
<div id="method-M000001" class="method-detail">
|
171
|
-
<a name="M000001"></a>
|
172
|
-
|
173
|
-
<div class="method-heading">
|
174
|
-
<a href="Object.src/M000001.html" target="Code" class="method-signature"
|
175
|
-
onclick="popupCode('Object.src/M000001.html');return false;">
|
176
|
-
<span class="method-name">metaclass</span><span class="method-args">()</span>
|
177
|
-
</a>
|
178
|
-
</div>
|
179
|
-
|
180
|
-
<div class="method-description">
|
181
|
-
<p>
|
182
|
-
The hidden singleton lurks behind everyone
|
183
|
-
</p>
|
184
|
-
</div>
|
185
|
-
</div>
|
186
|
-
|
187
|
-
|
188
|
-
</div>
|
189
|
-
|
190
|
-
|
191
|
-
</div>
|
192
|
-
|
193
|
-
|
194
|
-
<div id="validator-badges">
|
195
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
196
|
-
</div>
|
197
|
-
|
198
|
-
</body>
|
199
|
-
</html>
|
@@ -1,16 +0,0 @@
|
|
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>metaclass (Object)</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/metaid.rb, line 4</span>
|
14
|
-
4: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">metaclass</span>; <span class="ruby-keyword kw">class</span> <span class="ruby-operator"><<</span> <span class="ruby-keyword kw">self</span>; <span class="ruby-keyword kw">self</span>; <span class="ruby-keyword kw">end</span>; <span class="ruby-keyword kw">end</span></pre>
|
15
|
-
</body>
|
16
|
-
</html>
|
@@ -1,16 +0,0 @@
|
|
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>meta_eval (Object)</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/metaid.rb, line 5</span>
|
14
|
-
5: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">meta_eval</span> <span class="ruby-operator">&</span><span class="ruby-identifier">blk</span>; <span class="ruby-identifier">metaclass</span>.<span class="ruby-identifier">instance_eval</span> <span class="ruby-operator">&</span><span class="ruby-identifier">blk</span>; <span class="ruby-keyword kw">end</span></pre>
|
15
|
-
</body>
|
16
|
-
</html>
|
@@ -1,18 +0,0 @@
|
|
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>meta_def (Object)</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/metaid.rb, line 8</span>
|
14
|
-
8: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">meta_def</span> <span class="ruby-identifier">name</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">blk</span>
|
15
|
-
9: <span class="ruby-identifier">meta_eval</span> { <span class="ruby-identifier">define_method</span> <span class="ruby-identifier">name</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">blk</span> }
|
16
|
-
10: <span class="ruby-keyword kw">end</span></pre>
|
17
|
-
</body>
|
18
|
-
</html>
|
@@ -1,18 +0,0 @@
|
|
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>class_def (Object)</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/metaid.rb, line 13</span>
|
14
|
-
13: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">class_def</span> <span class="ruby-identifier">name</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">blk</span>
|
15
|
-
14: <span class="ruby-identifier">class_eval</span> { <span class="ruby-identifier">define_method</span> <span class="ruby-identifier">name</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">blk</span> }
|
16
|
-
15: <span class="ruby-keyword kw">end</span></pre>
|
17
|
-
</body>
|
18
|
-
</html>
|
data/doc/rdoc/created.rid
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Wed Feb 01 22:53:39 MST 2006
|
@@ -1,136 +0,0 @@
|
|
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>File: CHANGELOG</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="fileHeader">
|
50
|
-
<h1>CHANGELOG</h1>
|
51
|
-
<table class="header-table">
|
52
|
-
<tr class="top-aligned-row">
|
53
|
-
<td><strong>Path:</strong></td>
|
54
|
-
<td>CHANGELOG
|
55
|
-
</td>
|
56
|
-
</tr>
|
57
|
-
<tr class="top-aligned-row">
|
58
|
-
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>Wed Feb 01 21:36:52 MST 2006</td>
|
60
|
-
</tr>
|
61
|
-
</table>
|
62
|
-
</div>
|
63
|
-
<!-- banner header -->
|
64
|
-
|
65
|
-
<div id="bodyContent">
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
<div id="contextContent">
|
70
|
-
|
71
|
-
<div id="description">
|
72
|
-
<h1>0.3</h1>
|
73
|
-
<h3>02nd February, 2006</h3>
|
74
|
-
<ul>
|
75
|
-
<li>Allow <a
|
76
|
-
href="../classes/Markaby/Builder.html#M000008">Markaby::Builder.new</a>
|
77
|
-
without args.
|
78
|
-
|
79
|
-
</li>
|
80
|
-
<li>Rails helper method render_markaby.
|
81
|
-
|
82
|
-
</li>
|
83
|
-
</ul>
|
84
|
-
<h1>0.2</h1>
|
85
|
-
<h3>17th January, 2006</h3>
|
86
|
-
<ul>
|
87
|
-
<li>Public announcement.
|
88
|
-
|
89
|
-
</li>
|
90
|
-
<li>DOCTYPES, head tags.
|
91
|
-
|
92
|
-
</li>
|
93
|
-
<li>Works with Rails helpers.
|
94
|
-
|
95
|
-
</li>
|
96
|
-
</ul>
|
97
|
-
<h1>0.1</h1>
|
98
|
-
<h3>05th January, 2006</h3>
|
99
|
-
<ul>
|
100
|
-
<li>Initial import.
|
101
|
-
|
102
|
-
</li>
|
103
|
-
</ul>
|
104
|
-
|
105
|
-
</div>
|
106
|
-
|
107
|
-
|
108
|
-
</div>
|
109
|
-
|
110
|
-
|
111
|
-
</div>
|
112
|
-
|
113
|
-
|
114
|
-
<!-- if includes -->
|
115
|
-
|
116
|
-
<div id="section">
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
<!-- if method_list -->
|
126
|
-
|
127
|
-
|
128
|
-
</div>
|
129
|
-
|
130
|
-
|
131
|
-
<div id="validator-badges">
|
132
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
133
|
-
</div>
|
134
|
-
|
135
|
-
</body>
|
136
|
-
</html>
|
data/doc/rdoc/files/README.html
DELETED
@@ -1,326 +0,0 @@
|
|
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>File: README</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="fileHeader">
|
50
|
-
<h1>README</h1>
|
51
|
-
<table class="header-table">
|
52
|
-
<tr class="top-aligned-row">
|
53
|
-
<td><strong>Path:</strong></td>
|
54
|
-
<td>README
|
55
|
-
</td>
|
56
|
-
</tr>
|
57
|
-
<tr class="top-aligned-row">
|
58
|
-
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>Wed Feb 01 20:34:06 MST 2006</td>
|
60
|
-
</tr>
|
61
|
-
</table>
|
62
|
-
</div>
|
63
|
-
<!-- banner header -->
|
64
|
-
|
65
|
-
<div id="bodyContent">
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
<div id="contextContent">
|
70
|
-
|
71
|
-
<div id="description">
|
72
|
-
<h1><a href="../classes/Markaby.html">Markaby</a> (Markup as Ruby)</h1>
|
73
|
-
<p>
|
74
|
-
<a href="../classes/Markaby.html">Markaby</a> is a very short bit of code
|
75
|
-
for writing HTML pages in pure Ruby. It is an alternative to ERb which
|
76
|
-
weaves the two languages together. Also a replacement for templating
|
77
|
-
languages which use primitive languages that blend with HTML.
|
78
|
-
</p>
|
79
|
-
<h2>Using <a href="../classes/Markaby.html">Markaby</a> as a Rails plugin</h2>
|
80
|
-
<p>
|
81
|
-
Write Rails templates in pure Ruby. Example layout:
|
82
|
-
</p>
|
83
|
-
<pre>
|
84
|
-
html do
|
85
|
-
head do
|
86
|
-
title 'Products: ' + action_name
|
87
|
-
stylesheet_link_tag 'scaffold'
|
88
|
-
end
|
89
|
-
|
90
|
-
body do
|
91
|
-
p flash[:notice], :style => "color: green"
|
92
|
-
|
93
|
-
self << content_for_layout
|
94
|
-
end
|
95
|
-
end
|
96
|
-
</pre>
|
97
|
-
<h2>Using <a href="../classes/Markaby.html">Markaby</a> as a Ruby class</h2>
|
98
|
-
<p>
|
99
|
-
<a href="../classes/Markaby.html">Markaby</a> is flaming easy to call from
|
100
|
-
your Ruby classes.
|
101
|
-
</p>
|
102
|
-
<pre>
|
103
|
-
require 'markaby'
|
104
|
-
|
105
|
-
mab = Markaby::Builder.new
|
106
|
-
mab.html do
|
107
|
-
head { title "Boats.com" }
|
108
|
-
body do
|
109
|
-
h1 "Boats.com has great deals"
|
110
|
-
ul do
|
111
|
-
li "$49 for a canoe"
|
112
|
-
li "$39 for a raft"
|
113
|
-
li "$29 for a huge boot that floats and can fit 5 people"
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
puts mab.to_s
|
118
|
-
</pre>
|
119
|
-
<p>
|
120
|
-
<a href="../classes/Markaby/Builder.html#M000008">Markaby::Builder.new</a>
|
121
|
-
does take two arguments for passing in variables and a helper object. You
|
122
|
-
can also affix the block right on to the class.
|
123
|
-
</p>
|
124
|
-
<p>
|
125
|
-
See <a href="../classes/Markaby/Builder.html">Markaby::Builder</a> for all
|
126
|
-
of that.
|
127
|
-
</p>
|
128
|
-
<h1>A Note About <tt>instance_eval</tt></h1>
|
129
|
-
<p>
|
130
|
-
The <a href="../classes/Markaby/Builder.html">Markaby::Builder</a> class is
|
131
|
-
different from the normal Builder class, since it uses
|
132
|
-
<tt>instance_eval</tt> when running blocks. This cleans up the appearance
|
133
|
-
of the <a href="../classes/Markaby.html">Markaby</a> code you write. If
|
134
|
-
<tt>instance_eval</tt> was not used, the code would look like this:
|
135
|
-
</p>
|
136
|
-
<pre>
|
137
|
-
mab = Markaby::Builder.new
|
138
|
-
mab.html do
|
139
|
-
mab.head { mab.title "Boats.com" }
|
140
|
-
mab.body do
|
141
|
-
mab.h1 "Boats.com has great deals"
|
142
|
-
end
|
143
|
-
end
|
144
|
-
puts mab.to_s
|
145
|
-
</pre>
|
146
|
-
<p>
|
147
|
-
So, the advantage is the cleanliness of your code. The disadvantage is that
|
148
|
-
the block will run inside the <a
|
149
|
-
href="../classes/Markaby/Builder.html">Markaby::Builder</a> object’s
|
150
|
-
scope. This means that inside these blocks, <tt>self</tt> will be your <a
|
151
|
-
href="../classes/Markaby/Builder.html">Markaby::Builder</a> object. When
|
152
|
-
you use instance variables in these blocks, they will be instance variables
|
153
|
-
of the <a href="../classes/Markaby/Builder.html">Markaby::Builder</a>
|
154
|
-
object.
|
155
|
-
</p>
|
156
|
-
<p>
|
157
|
-
This doesn’t effect Rails users, but when used in regular Ruby code,
|
158
|
-
it can be a bit disorienting. You are recommended to put your <a
|
159
|
-
href="../classes/Markaby.html">Markaby</a> code in a module where it
|
160
|
-
won’t mix with anything.
|
161
|
-
</p>
|
162
|
-
<h1>A Note About Rails Helpers</h1>
|
163
|
-
<p>
|
164
|
-
When used in Rails templates, the Rails helper object is passed into <a
|
165
|
-
href="../classes/Markaby/Builder.html">Markaby::Builder</a>. When you call
|
166
|
-
helper methods inside <a href="../classes/Markaby.html">Markaby</a>, the
|
167
|
-
output from those methods will be output to the stream. This is incredibly
|
168
|
-
handy, since most Rails helpers output HTML tags.
|
169
|
-
</p>
|
170
|
-
<pre>
|
171
|
-
head do
|
172
|
-
javascript_include_tag 'prototype'
|
173
|
-
autodiscovery_link_tag
|
174
|
-
end
|
175
|
-
</pre>
|
176
|
-
<p>
|
177
|
-
However, some methods are designed to give back a String which you can use
|
178
|
-
elsewhere. Call the <tt>@helpers</tt> object with the method and
|
179
|
-
you’ll get the String back and nothing will be output.
|
180
|
-
</p>
|
181
|
-
<pre>
|
182
|
-
p "Total is: #{@helper.number_to_human_size @file_bytes}"
|
183
|
-
</pre>
|
184
|
-
<p>
|
185
|
-
Conversely, you may call instance variables from your controller by using a
|
186
|
-
method and its value will be returned, nothing will be output.
|
187
|
-
</p>
|
188
|
-
<pre>
|
189
|
-
# Inside imaginary ProductController
|
190
|
-
def list
|
191
|
-
@products = Product.find :all
|
192
|
-
end
|
193
|
-
|
194
|
-
# Inside app/views/product/list.mab
|
195
|
-
products.each do |product|
|
196
|
-
p product.title
|
197
|
-
end
|
198
|
-
</pre>
|
199
|
-
<h1>A Quick Tour</h1>
|
200
|
-
<p>
|
201
|
-
If you dive right into <a href="../classes/Markaby.html">Markaby</a>,
|
202
|
-
it’ll probably make good sense, but you’re likely to run into a
|
203
|
-
few kinks. Keep these pointers in mind and everything will be fine.
|
204
|
-
</p>
|
205
|
-
<h2>Element Classes</h2>
|
206
|
-
<p>
|
207
|
-
Element classes may be added by hooking methods onto container elements:
|
208
|
-
</p>
|
209
|
-
<pre>
|
210
|
-
div.entry do
|
211
|
-
h2.entryTitle 'Son of WebPage'
|
212
|
-
div.entrySection %{by Anthony}
|
213
|
-
div.entryContent 'Okay, once again, the idea here is ...'
|
214
|
-
end
|
215
|
-
</pre>
|
216
|
-
<p>
|
217
|
-
Which results in:
|
218
|
-
</p>
|
219
|
-
<pre>
|
220
|
-
<div class="entry">
|
221
|
-
<h2 class="entryTitle">Son of WebPage</h2>
|
222
|
-
<div class="entrySection">by Anthony</div>
|
223
|
-
<div class="entryContent">Okay, once again, the idea here is ...</div>
|
224
|
-
</div>
|
225
|
-
</pre>
|
226
|
-
<h2>Element IDs</h2>
|
227
|
-
<p>
|
228
|
-
IDs may be added by the use of bang methods:
|
229
|
-
</p>
|
230
|
-
<pre>
|
231
|
-
div.page!
|
232
|
-
div.content!
|
233
|
-
h1 "A Short Short Saintly Dog"
|
234
|
-
end
|
235
|
-
end
|
236
|
-
</pre>
|
237
|
-
<p>
|
238
|
-
Which results in:
|
239
|
-
</p>
|
240
|
-
<pre>
|
241
|
-
<div id="page">
|
242
|
-
<div id="content">
|
243
|
-
<h1>A Short Short Saintly Dog</h1>
|
244
|
-
</div>
|
245
|
-
</div>
|
246
|
-
</pre>
|
247
|
-
<h2><a href="../classes/Markaby.html">Markaby</a> assumes XHTML 1.0 Transitional</h2>
|
248
|
-
<p>
|
249
|
-
Output defaults to XHTML 1.0 Transitional. To do XHTML 1.0 Strict, try
|
250
|
-
this:
|
251
|
-
</p>
|
252
|
-
<pre>
|
253
|
-
xhtml_strict do
|
254
|
-
# innerds
|
255
|
-
end
|
256
|
-
</pre>
|
257
|
-
<h2>The <tt>capture</tt> Method</h2>
|
258
|
-
<p>
|
259
|
-
Want to catch a block of HTML as a string and play with it a bit? Use the
|
260
|
-
<tt>capture</tt> method.
|
261
|
-
</p>
|
262
|
-
<p>
|
263
|
-
Commonly used to join HTML blocks together:
|
264
|
-
</p>
|
265
|
-
<pre>
|
266
|
-
div.menu! \
|
267
|
-
['5.gets', 'bits', 'cult', 'inspect', '-h'].map do |category|
|
268
|
-
capture { link_to category }
|
269
|
-
end.
|
270
|
-
join( " | " )
|
271
|
-
</pre>
|
272
|
-
<h2>The <tt>tag!</tt> Method</h2>
|
273
|
-
<p>
|
274
|
-
If you need to force a tag at any time, call <tt>tag!</tt> with the tag
|
275
|
-
name followed by the possible arguments and block. The CssProxy won’t
|
276
|
-
work with this technique.
|
277
|
-
</p>
|
278
|
-
<pre>
|
279
|
-
tag! :select, :id => "country_list" do
|
280
|
-
countries.each do |country|
|
281
|
-
tag! :option, country
|
282
|
-
end
|
283
|
-
end
|
284
|
-
</pre>
|
285
|
-
<h1>Credits</h1>
|
286
|
-
<p>
|
287
|
-
<a href="../classes/Markaby.html">Markaby</a> is a work of immense hope by
|
288
|
-
Tim Fletcher and why the lucky stiff. Thankyou for giving it a whirl.
|
289
|
-
</p>
|
290
|
-
<p>
|
291
|
-
<a href="../classes/Markaby.html">Markaby</a> is inspired by the HTML
|
292
|
-
library within cgi.rb. Hopefully it will turn around and take some cues.
|
293
|
-
</p>
|
294
|
-
|
295
|
-
</div>
|
296
|
-
|
297
|
-
|
298
|
-
</div>
|
299
|
-
|
300
|
-
|
301
|
-
</div>
|
302
|
-
|
303
|
-
|
304
|
-
<!-- if includes -->
|
305
|
-
|
306
|
-
<div id="section">
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
<!-- if method_list -->
|
316
|
-
|
317
|
-
|
318
|
-
</div>
|
319
|
-
|
320
|
-
|
321
|
-
<div id="validator-badges">
|
322
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
323
|
-
</div>
|
324
|
-
|
325
|
-
</body>
|
326
|
-
</html>
|