tagz 4.2.0 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +80 -2
- data/a.rb +2 -5
- data/install.rb +0 -0
- data/lib/tagz.rb +6 -1
- data/samples/f.rb +17 -0
- metadata +4 -3
data/README
CHANGED
@@ -21,12 +21,63 @@ DESCRIPTION
|
|
21
21
|
easily in any context without heavyweight syntax or scoping issues, like a
|
22
22
|
ninja sword through butter.
|
23
23
|
|
24
|
+
RAILS
|
25
|
+
|
26
|
+
in config/environment.rb
|
27
|
+
|
28
|
+
require 'tagz'
|
29
|
+
|
30
|
+
in a helper
|
31
|
+
|
32
|
+
def list_of_users
|
33
|
+
ul_(:class => 'users'){
|
34
|
+
@users.each{|user| li_{ user }}
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
in a view
|
39
|
+
|
40
|
+
<%=
|
41
|
+
table_{
|
42
|
+
rows.each do |row|
|
43
|
+
tr_{
|
44
|
+
row.each do |cell|
|
45
|
+
td_{ cell }
|
46
|
+
end
|
47
|
+
}
|
48
|
+
end
|
49
|
+
}
|
50
|
+
%>
|
51
|
+
|
52
|
+
in a controller
|
53
|
+
|
54
|
+
def ajax_responder
|
55
|
+
text =
|
56
|
+
tagz{
|
57
|
+
table_{
|
58
|
+
rows.each do |row|
|
59
|
+
tr_{
|
60
|
+
row.each do |cell|
|
61
|
+
td_{ cell }
|
62
|
+
end
|
63
|
+
}
|
64
|
+
end
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
render :text => text
|
69
|
+
end
|
70
|
+
|
24
71
|
INSTALL
|
25
72
|
|
26
73
|
gem install tagz
|
27
74
|
|
28
75
|
HISTORY
|
29
76
|
|
77
|
+
4.3.0
|
78
|
+
- detect rails and auto-include into ActionController::Base and include
|
79
|
+
globally into ActionView::Base
|
80
|
+
|
30
81
|
4.2.0
|
31
82
|
- general lib cleanup
|
32
83
|
- introduction of dual-mixin technique (Tagz.globally)
|
@@ -204,12 +255,39 @@ SAMPLES
|
|
204
255
|
begin
|
205
256
|
html_{ 'not out here' }
|
206
257
|
rescue Object => e
|
207
|
-
|
258
|
+
p :backtrace => e.backtrace
|
208
259
|
end
|
209
260
|
|
210
261
|
|
211
262
|
~ > ruby samples/e.rb
|
212
263
|
|
213
264
|
<html>works only in here</html>
|
214
|
-
samples/e.rb:17
|
265
|
+
{:backtrace=>["samples/e.rb:17"]}
|
266
|
+
|
267
|
+
|
268
|
+
<========< samples/f.rb >========>
|
269
|
+
|
270
|
+
~ > cat samples/f.rb
|
271
|
+
|
272
|
+
#
|
273
|
+
# tagz.rb can generate really compact html. this is great to save bandwidth
|
274
|
+
# but can sometimes make reading the generated html a bit rough. of course
|
275
|
+
# using tidy or the dom inspector in firebug obviates the issue; nevertheless
|
276
|
+
# it's sometime nice to break things up a little. you can use 'tagz << "\n"'
|
277
|
+
# or the special shorthand '__' to accomplish this
|
278
|
+
#
|
279
|
+
|
280
|
+
require 'tagz'
|
281
|
+
include Tagz.globally
|
282
|
+
|
283
|
+
p div_{
|
284
|
+
span_{ true }
|
285
|
+
__
|
286
|
+
span_{ false } # hey ryan, i fixed this ;-)
|
287
|
+
__
|
288
|
+
}
|
289
|
+
|
290
|
+
~ > ruby samples/f.rb
|
291
|
+
|
292
|
+
"<div><span>true</span>\n<span>false</span>\n</div>"
|
215
293
|
|
data/a.rb
CHANGED
data/install.rb
CHANGED
File without changes
|
data/lib/tagz.rb
CHANGED
@@ -134,7 +134,7 @@ unless defined? Tagz
|
|
134
134
|
if block
|
135
135
|
size = tagz.size
|
136
136
|
value = block.call(tagz)
|
137
|
-
|
137
|
+
if NilClass == value
|
138
138
|
tagz[-1] = "/>"
|
139
139
|
else
|
140
140
|
tagz << value.to_s unless(Fragment === value or tagz.size > size)
|
@@ -220,4 +220,9 @@ unless defined? Tagz
|
|
220
220
|
end
|
221
221
|
end
|
222
222
|
|
223
|
+
if defined?(Rails)
|
224
|
+
ActionView::Base.send(:include, Tagz.globally)
|
225
|
+
ActionController::Base.send(:include, Tagz)
|
226
|
+
end
|
227
|
+
|
223
228
|
end
|
data/samples/f.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#
|
2
|
+
# tagz.rb can generate really compact html. this is great to save bandwidth
|
3
|
+
# but can sometimes make reading the generated html a bit rough. of course
|
4
|
+
# using tidy or the dom inspector in firebug obviates the issue; nevertheless
|
5
|
+
# it's sometime nice to break things up a little. you can use 'tagz << "\n"'
|
6
|
+
# or the special shorthand '__' to accomplish this
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'tagz'
|
10
|
+
include Tagz.globally
|
11
|
+
|
12
|
+
p div_{
|
13
|
+
span_{ true }
|
14
|
+
__
|
15
|
+
span_{ false } # hey ryan, i fixed this ;-)
|
16
|
+
__
|
17
|
+
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tagz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ara T. Howard
|
@@ -9,7 +9,7 @@ autorequire: tagz
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-10-22 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -35,6 +35,7 @@ files:
|
|
35
35
|
- samples/c.rb
|
36
36
|
- samples/d.rb
|
37
37
|
- samples/e.rb
|
38
|
+
- samples/f.rb
|
38
39
|
has_rdoc: false
|
39
40
|
homepage: http://codeforpeople.com/lib/ruby/tagz/
|
40
41
|
post_install_message:
|
@@ -57,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
58
|
requirements: []
|
58
59
|
|
59
60
|
rubyforge_project:
|
60
|
-
rubygems_version: 1.0
|
61
|
+
rubygems_version: 1.2.0
|
61
62
|
signing_key:
|
62
63
|
specification_version: 2
|
63
64
|
summary: tagz
|