inversion 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/ChangeLog +157 -28
- data/History.rdoc +8 -0
- data/Manifest.txt +2 -3
- data/Rakefile +1 -3
- data/lib/inversion.rb +2 -2
- data/lib/inversion/exceptions.rb +1 -1
- data/lib/inversion/{template/parser.rb → parser.rb} +5 -5
- data/lib/inversion/renderstate.rb +55 -5
- data/lib/inversion/template.rb +5 -3
- data/lib/inversion/template/attrtag.rb +19 -12
- data/lib/inversion/template/begintag.rb +1 -2
- data/lib/inversion/template/configtag.rb +7 -1
- data/lib/inversion/template/containertag.rb +8 -3
- data/lib/inversion/template/elsetag.rb +16 -0
- data/lib/inversion/template/elsiftag.rb +16 -0
- data/lib/inversion/template/escapetag.rb +1 -1
- data/lib/inversion/template/fortag.rb +2 -5
- data/lib/inversion/template/iftag.rb +17 -35
- data/lib/inversion/template/importtag.rb +2 -1
- data/lib/inversion/template/includetag.rb +2 -0
- data/lib/inversion/template/node.rb +1 -1
- data/lib/inversion/template/tag.rb +5 -2
- data/lib/inversion/template/textnode.rb +1 -2
- data/lib/inversion/template/unlesstag.rb +16 -26
- data/lib/inversion/template/yieldtag.rb +3 -8
- data/spec/inversion/{template/parser_spec.rb → parser_spec.rb} +14 -14
- data/spec/inversion/renderstate_spec.rb +242 -165
- data/spec/inversion/template/attrtag_spec.rb +10 -18
- data/spec/inversion/template/begintag_spec.rb +13 -12
- data/spec/inversion/template/configtag_spec.rb +5 -7
- data/spec/inversion/template/elsetag_spec.rb +5 -5
- data/spec/inversion/template/elsiftag_spec.rb +5 -5
- data/spec/inversion/template/endtag_spec.rb +1 -1
- data/spec/inversion/template/fortag_spec.rb +22 -1
- data/spec/inversion/template/iftag_spec.rb +14 -0
- data/spec/inversion/template/rescuetag_spec.rb +4 -4
- data/spec/inversion/template/tag_spec.rb +6 -4
- data/spec/inversion/template/unlesstag_spec.rb +12 -6
- data/spec/inversion/template/yieldtag_spec.rb +2 -2
- metadata +31 -32
- metadata.gz.sig +0 -0
- data/lib/inversion/template/conditionaltag.rb +0 -49
@@ -26,7 +26,7 @@ describe Inversion::Template::YieldTag do
|
|
26
26
|
|
27
27
|
|
28
28
|
it "calls the renderstate's block before rendering, and renders as its return value" do
|
29
|
-
tag = Inversion::Template::YieldTag.new
|
29
|
+
tag = Inversion::Template::YieldTag.new( '' )
|
30
30
|
renderstate = Inversion::RenderState.new do |state|
|
31
31
|
:return_value
|
32
32
|
end
|
@@ -40,7 +40,7 @@ describe Inversion::Template::YieldTag do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
it "renders as nothing if there wasn't a render block" do
|
43
|
-
tag = Inversion::Template::YieldTag.new
|
43
|
+
tag = Inversion::Template::YieldTag.new( '' )
|
44
44
|
renderstate = Inversion::RenderState.new
|
45
45
|
tag.before_rendering( renderstate )
|
46
46
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inversion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -49,11 +49,11 @@ cert_chain:
|
|
49
49
|
-----END CERTIFICATE-----
|
50
50
|
|
51
51
|
'
|
52
|
-
date: 2011-09-
|
52
|
+
date: 2011-09-27 00:00:00.000000000Z
|
53
53
|
dependencies:
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
55
|
name: hoe-mercurial
|
56
|
-
requirement: &
|
56
|
+
requirement: &70311260655740 !ruby/object:Gem::Requirement
|
57
57
|
none: false
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
@@ -61,21 +61,21 @@ dependencies:
|
|
61
61
|
version: 1.3.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
|
-
version_requirements: *
|
64
|
+
version_requirements: *70311260655740
|
65
65
|
- !ruby/object:Gem::Dependency
|
66
66
|
name: hoe-manualgen
|
67
|
-
requirement: &
|
67
|
+
requirement: &70311260655280 !ruby/object:Gem::Requirement
|
68
68
|
none: false
|
69
69
|
requirements:
|
70
70
|
- - ~>
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: 0.
|
72
|
+
version: 0.2.0
|
73
73
|
type: :development
|
74
74
|
prerelease: false
|
75
|
-
version_requirements: *
|
75
|
+
version_requirements: *70311260655280
|
76
76
|
- !ruby/object:Gem::Dependency
|
77
77
|
name: hoe-highline
|
78
|
-
requirement: &
|
78
|
+
requirement: &70311260654860 !ruby/object:Gem::Requirement
|
79
79
|
none: false
|
80
80
|
requirements:
|
81
81
|
- - ~>
|
@@ -83,10 +83,10 @@ dependencies:
|
|
83
83
|
version: 0.0.1
|
84
84
|
type: :development
|
85
85
|
prerelease: false
|
86
|
-
version_requirements: *
|
86
|
+
version_requirements: *70311260654860
|
87
87
|
- !ruby/object:Gem::Dependency
|
88
88
|
name: rspec
|
89
|
-
requirement: &
|
89
|
+
requirement: &70311260654400 !ruby/object:Gem::Requirement
|
90
90
|
none: false
|
91
91
|
requirements:
|
92
92
|
- - ~>
|
@@ -94,10 +94,10 @@ dependencies:
|
|
94
94
|
version: 2.6.0
|
95
95
|
type: :development
|
96
96
|
prerelease: false
|
97
|
-
version_requirements: *
|
97
|
+
version_requirements: *70311260654400
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: tilt
|
100
|
-
requirement: &
|
100
|
+
requirement: &70311260653980 !ruby/object:Gem::Requirement
|
101
101
|
none: false
|
102
102
|
requirements:
|
103
103
|
- - ~>
|
@@ -105,10 +105,10 @@ dependencies:
|
|
105
105
|
version: 1.3.2
|
106
106
|
type: :development
|
107
107
|
prerelease: false
|
108
|
-
version_requirements: *
|
108
|
+
version_requirements: *70311260653980
|
109
109
|
- !ruby/object:Gem::Dependency
|
110
110
|
name: sinatra
|
111
|
-
requirement: &
|
111
|
+
requirement: &70311260653560 !ruby/object:Gem::Requirement
|
112
112
|
none: false
|
113
113
|
requirements:
|
114
114
|
- - ~>
|
@@ -116,10 +116,10 @@ dependencies:
|
|
116
116
|
version: 1.2.6
|
117
117
|
type: :development
|
118
118
|
prerelease: false
|
119
|
-
version_requirements: *
|
119
|
+
version_requirements: *70311260653560
|
120
120
|
- !ruby/object:Gem::Dependency
|
121
121
|
name: rack-test
|
122
|
-
requirement: &
|
122
|
+
requirement: &70311260653140 !ruby/object:Gem::Requirement
|
123
123
|
none: false
|
124
124
|
requirements:
|
125
125
|
- - ~>
|
@@ -127,10 +127,10 @@ dependencies:
|
|
127
127
|
version: 0.6.0
|
128
128
|
type: :development
|
129
129
|
prerelease: false
|
130
|
-
version_requirements: *
|
130
|
+
version_requirements: *70311260653140
|
131
131
|
- !ruby/object:Gem::Dependency
|
132
132
|
name: simplecov
|
133
|
-
requirement: &
|
133
|
+
requirement: &70311260652720 !ruby/object:Gem::Requirement
|
134
134
|
none: false
|
135
135
|
requirements:
|
136
136
|
- - ~>
|
@@ -138,10 +138,10 @@ dependencies:
|
|
138
138
|
version: 0.4.2
|
139
139
|
type: :development
|
140
140
|
prerelease: false
|
141
|
-
version_requirements: *
|
141
|
+
version_requirements: *70311260652720
|
142
142
|
- !ruby/object:Gem::Dependency
|
143
143
|
name: hoe-manualgen
|
144
|
-
requirement: &
|
144
|
+
requirement: &70311260652300 !ruby/object:Gem::Requirement
|
145
145
|
none: false
|
146
146
|
requirements:
|
147
147
|
- - ~>
|
@@ -149,10 +149,10 @@ dependencies:
|
|
149
149
|
version: 0.2.0
|
150
150
|
type: :development
|
151
151
|
prerelease: false
|
152
|
-
version_requirements: *
|
152
|
+
version_requirements: *70311260652300
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: trollop
|
155
|
-
requirement: &
|
155
|
+
requirement: &70311260651860 !ruby/object:Gem::Requirement
|
156
156
|
none: false
|
157
157
|
requirements:
|
158
158
|
- - ~>
|
@@ -160,10 +160,10 @@ dependencies:
|
|
160
160
|
version: 1.16.2
|
161
161
|
type: :development
|
162
162
|
prerelease: false
|
163
|
-
version_requirements: *
|
163
|
+
version_requirements: *70311260651860
|
164
164
|
- !ruby/object:Gem::Dependency
|
165
165
|
name: highline
|
166
|
-
requirement: &
|
166
|
+
requirement: &70311260651440 !ruby/object:Gem::Requirement
|
167
167
|
none: false
|
168
168
|
requirements:
|
169
169
|
- - ~>
|
@@ -171,10 +171,10 @@ dependencies:
|
|
171
171
|
version: 1.6.2
|
172
172
|
type: :development
|
173
173
|
prerelease: false
|
174
|
-
version_requirements: *
|
174
|
+
version_requirements: *70311260651440
|
175
175
|
- !ruby/object:Gem::Dependency
|
176
176
|
name: sysexits
|
177
|
-
requirement: &
|
177
|
+
requirement: &70311260651020 !ruby/object:Gem::Requirement
|
178
178
|
none: false
|
179
179
|
requirements:
|
180
180
|
- - ~>
|
@@ -182,10 +182,10 @@ dependencies:
|
|
182
182
|
version: 1.0.2
|
183
183
|
type: :development
|
184
184
|
prerelease: false
|
185
|
-
version_requirements: *
|
185
|
+
version_requirements: *70311260651020
|
186
186
|
- !ruby/object:Gem::Dependency
|
187
187
|
name: hoe
|
188
|
-
requirement: &
|
188
|
+
requirement: &70311260650600 !ruby/object:Gem::Requirement
|
189
189
|
none: false
|
190
190
|
requirements:
|
191
191
|
- - ~>
|
@@ -193,7 +193,7 @@ dependencies:
|
|
193
193
|
version: '2.12'
|
194
194
|
type: :development
|
195
195
|
prerelease: false
|
196
|
-
version_requirements: *
|
196
|
+
version_requirements: *70311260650600
|
197
197
|
description: ! 'Inversion is a templating system for Ruby. It uses the "Inversion
|
198
198
|
of Control" principle to decouple
|
199
199
|
|
@@ -222,6 +222,7 @@ files:
|
|
222
222
|
- lib/inversion/exceptions.rb
|
223
223
|
- lib/inversion/mixins.rb
|
224
224
|
- lib/inversion/monkeypatches.rb
|
225
|
+
- lib/inversion/parser.rb
|
225
226
|
- lib/inversion/renderstate.rb
|
226
227
|
- lib/inversion/sinatra.rb
|
227
228
|
- lib/inversion/template.rb
|
@@ -230,7 +231,6 @@ files:
|
|
230
231
|
- lib/inversion/template/calltag.rb
|
231
232
|
- lib/inversion/template/codetag.rb
|
232
233
|
- lib/inversion/template/commenttag.rb
|
233
|
-
- lib/inversion/template/conditionaltag.rb
|
234
234
|
- lib/inversion/template/configtag.rb
|
235
235
|
- lib/inversion/template/containertag.rb
|
236
236
|
- lib/inversion/template/defaulttag.rb
|
@@ -243,7 +243,6 @@ files:
|
|
243
243
|
- lib/inversion/template/importtag.rb
|
244
244
|
- lib/inversion/template/includetag.rb
|
245
245
|
- lib/inversion/template/node.rb
|
246
|
-
- lib/inversion/template/parser.rb
|
247
246
|
- lib/inversion/template/pptag.rb
|
248
247
|
- lib/inversion/template/publishtag.rb
|
249
248
|
- lib/inversion/template/rescuetag.rb
|
@@ -259,6 +258,7 @@ files:
|
|
259
258
|
- spec/data/sinatra/hello.inversion
|
260
259
|
- spec/inversion/mixins_spec.rb
|
261
260
|
- spec/inversion/monkeypatches_spec.rb
|
261
|
+
- spec/inversion/parser_spec.rb
|
262
262
|
- spec/inversion/renderstate_spec.rb
|
263
263
|
- spec/inversion/sinatra_spec.rb
|
264
264
|
- spec/inversion/template/attrtag_spec.rb
|
@@ -278,7 +278,6 @@ files:
|
|
278
278
|
- spec/inversion/template/importtag_spec.rb
|
279
279
|
- spec/inversion/template/includetag_spec.rb
|
280
280
|
- spec/inversion/template/node_spec.rb
|
281
|
-
- spec/inversion/template/parser_spec.rb
|
282
281
|
- spec/inversion/template/pptag_spec.rb
|
283
282
|
- spec/inversion/template/publishtag_spec.rb
|
284
283
|
- spec/inversion/template/rescuetag_spec.rb
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,49 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# vim: set noet nosta sw=4 ts=4 :
|
3
|
-
|
4
|
-
require 'inversion/template'
|
5
|
-
|
6
|
-
# A mixin for a tag that manages conditional rendering of its subnodes.
|
7
|
-
module Inversion::Template::ConditionalTag
|
8
|
-
|
9
|
-
### Add conditional instance variables.
|
10
|
-
def initialize( *args ) # :notnew:
|
11
|
-
super
|
12
|
-
|
13
|
-
@rendering_enabled = false
|
14
|
-
@rendering_was_enabled = false
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
|
-
#########
|
19
|
-
protected
|
20
|
-
#########
|
21
|
-
|
22
|
-
### Enable rendering of subnodes.
|
23
|
-
def enable_rendering
|
24
|
-
self.log.debug " enabling rendering."
|
25
|
-
@rendering_enabled = @rendering_was_enabled = true
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
### Disable rendering of subnodes.
|
30
|
-
def disable_rendering
|
31
|
-
self.log.debug " disabling rendering."
|
32
|
-
@rendering_enabled = false
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
|
-
### Return +true+ if rendering is enabled.
|
37
|
-
def rendering_enabled?
|
38
|
-
return @rendering_enabled
|
39
|
-
end
|
40
|
-
|
41
|
-
|
42
|
-
### Return +true+ if rendering has been enabled since the tag started rendering.
|
43
|
-
def rendering_was_enabled?
|
44
|
-
return @rendering_was_enabled
|
45
|
-
end
|
46
|
-
|
47
|
-
|
48
|
-
end # module Inversion::Template::ConditionalTag
|
49
|
-
|