wlang 2.0.0.beta → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -8
- data/Gemfile.lock +4 -8
- data/Manifest.txt +0 -2
- data/README.md +36 -7
- data/lib/wlang.rb +3 -0
- data/lib/wlang/command.rb +3 -11
- data/lib/wlang/compiler.rb +11 -20
- data/lib/wlang/compiler/autospacing.rb +4 -2
- data/lib/wlang/compiler/dialect_enforcer.rb +1 -1
- data/lib/wlang/compiler/to_ruby_code.rb +1 -1
- data/lib/wlang/dialect.rb +163 -23
- data/lib/wlang/html.rb +9 -8
- data/lib/wlang/loader.rb +2 -4
- data/lib/wlang/scope.rb +17 -8
- data/lib/wlang/scope/proc_scope.rb +18 -0
- data/lib/wlang/source.rb +56 -0
- data/lib/wlang/source/front_matter.rb +51 -0
- data/lib/wlang/template.rb +55 -17
- data/lib/wlang/tilt.rb +3 -0
- data/lib/wlang/tilt/wlang_template.rb +43 -0
- data/lib/wlang/version.rb +1 -2
- data/spec/fixtures/templates/{hello.tpl → hello.wlang} +0 -0
- data/spec/fixtures/templates/hello_with_data.wlang +4 -0
- data/spec/fixtures/templates/hello_with_explicit_locals.wlang +6 -0
- data/spec/fixtures/templates/hello_with_partials.wlang +7 -0
- data/spec/integration/examples/{1-basics.txt → 1-html-intro/1-basics.md} +1 -1
- data/spec/integration/examples/{2-imperative.txt → 1-html-intro/2-imperative.md} +1 -1
- data/spec/integration/examples/{3-partials.txt → 1-html-intro/3-partials.md} +0 -0
- data/spec/integration/examples/{4-recursion.txt → 1-html-intro/4-recursion.md} +1 -2
- data/spec/integration/examples/1-html-intro/5-polymorphism.md +17 -0
- data/spec/integration/html/test_caret.rb +15 -2
- data/spec/integration/html/test_question.rb +12 -2
- data/spec/integration/html/test_sharp.rb +5 -1
- data/spec/integration/html/test_star.rb +1 -3
- data/spec/integration/test_examples.rb +2 -1
- data/spec/integration/test_readme.rb +14 -2
- data/spec/integration/tilt/test_wlang_template.rb +13 -0
- data/spec/spec_helper.rb +3 -3
- data/spec/unit/compiler/test_dialect_enforcer.rb +1 -1
- data/spec/unit/compiler/test_to_ruby_proc.rb +15 -0
- data/spec/unit/dialect/test_compile.rb +0 -10
- data/spec/unit/dialect/test_evaluate.rb +36 -28
- data/spec/unit/dialect/test_new.rb +61 -0
- data/spec/unit/dialect/test_tag.rb +36 -0
- data/spec/unit/dialect/test_tag_dispatching_name.rb +22 -0
- data/spec/unit/dialect/test_with_scope.rb +8 -11
- data/spec/unit/scope/test_chain.rb +29 -0
- data/spec/unit/scope/test_coerce.rb +13 -2
- data/spec/unit/scope/test_proc_scope.rb +18 -0
- data/spec/unit/source/front_matter/test_locals.rb +39 -0
- data/spec/unit/source/front_matter/test_template_content.rb +22 -0
- data/spec/unit/source/test_locals.rb +12 -0
- data/spec/unit/source/test_path.rb +27 -0
- data/spec/unit/source/test_template_content.rb +37 -0
- data/spec/unit/source/test_with_front_matter.rb +19 -0
- data/spec/unit/template/test_call.rb +16 -0
- data/spec/unit/template/test_new.rb +20 -0
- data/spec/unit/template/test_path.rb +28 -0
- data/spec/unit/template/test_render.rb +44 -0
- data/spec/unit/template/test_to_ast.rb +12 -0
- data/spec/unit/template/test_to_ruby_code.rb +13 -0
- data/spec/unit/template/test_to_ruby_proc.rb +12 -0
- data/spec/unit/template/test_yaml_front_matter.rb +22 -0
- data/spec/unit/tilt/test_wlang_template.rb +65 -0
- data/wlang.gemspec +3 -5
- data/wlang.noespec +12 -17
- metadata +117 -85
- data/lib/wlang/dialect/dispatching.rb +0 -51
- data/lib/wlang/dialect/evaluation.rb +0 -30
- data/lib/wlang/dialect/tags.rb +0 -50
- data/lib/wlang/mustang.rb +0 -90
- data/spec/integration/test_mustang.rb +0 -120
- data/spec/unit/dialect/test_dispatching.rb +0 -19
- data/spec/unit/dialect/test_tags.rb +0 -32
data/wlang.noespec
CHANGED
@@ -3,16 +3,13 @@ template-info:
|
|
3
3
|
version: 1.7.4
|
4
4
|
links:
|
5
5
|
source: https://github.com/blambeau/noe
|
6
|
-
manifest:
|
7
|
-
lib/__lower__/loader.rb:
|
8
|
-
safe-override: false
|
9
6
|
variables:
|
10
7
|
lower:
|
11
8
|
wlang
|
12
9
|
upper:
|
13
10
|
WLang
|
14
11
|
version:
|
15
|
-
2.0.0
|
12
|
+
2.0.0
|
16
13
|
summary: |-
|
17
14
|
WLang is a powerful code generation and templating engine
|
18
15
|
description: |-
|
@@ -31,16 +28,14 @@ variables:
|
|
31
28
|
- http://blambeau.github.com/wlang
|
32
29
|
- http://revision-zero.org/wlang
|
33
30
|
dependencies:
|
34
|
-
- {name: citrus,
|
35
|
-
- {name: temple,
|
36
|
-
- {name:
|
37
|
-
- {name:
|
38
|
-
- {name:
|
39
|
-
- {name:
|
40
|
-
- {name:
|
41
|
-
- {name:
|
42
|
-
- {name:
|
43
|
-
- {name:
|
44
|
-
- {name:
|
45
|
-
- {name: yard, version: "~> 0.8.1", groups: [development]}
|
46
|
-
- {name: bluecloth, version: "~> 2.2.0", groups: [development]}
|
31
|
+
- {name: citrus, version: "~> 2.4.1", groups: [runtime]}
|
32
|
+
- {name: temple, version: "~> 0.4.0", groups: [runtime]}
|
33
|
+
- {name: quickl, version: "~> 0.4.3", groups: [runtime]}
|
34
|
+
- {name: awesome_print, version: "~> 1.0.2", groups: [runtime]}
|
35
|
+
- {name: epath, version: ">= 0.2", groups: [runtime]}
|
36
|
+
- {name: tilt, version: "~> 1.3", groups: [development]}
|
37
|
+
- {name: rake, version: "~> 0.9.2", groups: [development]}
|
38
|
+
- {name: bundler, version: "~> 1.0", groups: [development]}
|
39
|
+
- {name: rspec, version: "~> 2.10.0", groups: [development]}
|
40
|
+
- {name: yard, version: "~> 0.8.1", groups: [development]}
|
41
|
+
- {name: bluecloth, version: "~> 2.2.0", groups: [development]}
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wlang
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0
|
5
|
-
prerelease:
|
4
|
+
version: 2.0.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Bernard Lambeau
|
@@ -10,33 +10,22 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-06-
|
13
|
+
date: 2012-06-12 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
17
|
-
requirement: &
|
16
|
+
name: tilt
|
17
|
+
requirement: &70288043592580 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: '1.3'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name: mustache
|
28
|
-
requirement: &70335748962060 !ruby/object:Gem::Requirement
|
29
|
-
none: false
|
30
|
-
requirements:
|
31
|
-
- - ~>
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.99.4
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: *70335748962060
|
25
|
+
version_requirements: *70288043592580
|
37
26
|
- !ruby/object:Gem::Dependency
|
38
27
|
name: rake
|
39
|
-
requirement: &
|
28
|
+
requirement: &70288043592080 !ruby/object:Gem::Requirement
|
40
29
|
none: false
|
41
30
|
requirements:
|
42
31
|
- - ~>
|
@@ -44,10 +33,10 @@ dependencies:
|
|
44
33
|
version: 0.9.2
|
45
34
|
type: :development
|
46
35
|
prerelease: false
|
47
|
-
version_requirements: *
|
36
|
+
version_requirements: *70288043592080
|
48
37
|
- !ruby/object:Gem::Dependency
|
49
38
|
name: bundler
|
50
|
-
requirement: &
|
39
|
+
requirement: &70288043591620 !ruby/object:Gem::Requirement
|
51
40
|
none: false
|
52
41
|
requirements:
|
53
42
|
- - ~>
|
@@ -55,10 +44,10 @@ dependencies:
|
|
55
44
|
version: '1.0'
|
56
45
|
type: :development
|
57
46
|
prerelease: false
|
58
|
-
version_requirements: *
|
47
|
+
version_requirements: *70288043591620
|
59
48
|
- !ruby/object:Gem::Dependency
|
60
49
|
name: rspec
|
61
|
-
requirement: &
|
50
|
+
requirement: &70288043591160 !ruby/object:Gem::Requirement
|
62
51
|
none: false
|
63
52
|
requirements:
|
64
53
|
- - ~>
|
@@ -66,21 +55,10 @@ dependencies:
|
|
66
55
|
version: 2.10.0
|
67
56
|
type: :development
|
68
57
|
prerelease: false
|
69
|
-
version_requirements: *
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: epath
|
72
|
-
requirement: &70335748940940 !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ~>
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: 0.1.0
|
78
|
-
type: :development
|
79
|
-
prerelease: false
|
80
|
-
version_requirements: *70335748940940
|
58
|
+
version_requirements: *70288043591160
|
81
59
|
- !ruby/object:Gem::Dependency
|
82
60
|
name: yard
|
83
|
-
requirement: &
|
61
|
+
requirement: &70288043590700 !ruby/object:Gem::Requirement
|
84
62
|
none: false
|
85
63
|
requirements:
|
86
64
|
- - ~>
|
@@ -88,10 +66,10 @@ dependencies:
|
|
88
66
|
version: 0.8.1
|
89
67
|
type: :development
|
90
68
|
prerelease: false
|
91
|
-
version_requirements: *
|
69
|
+
version_requirements: *70288043590700
|
92
70
|
- !ruby/object:Gem::Dependency
|
93
71
|
name: bluecloth
|
94
|
-
requirement: &
|
72
|
+
requirement: &70288043590240 !ruby/object:Gem::Requirement
|
95
73
|
none: false
|
96
74
|
requirements:
|
97
75
|
- - ~>
|
@@ -99,10 +77,10 @@ dependencies:
|
|
99
77
|
version: 2.2.0
|
100
78
|
type: :development
|
101
79
|
prerelease: false
|
102
|
-
version_requirements: *
|
80
|
+
version_requirements: *70288043590240
|
103
81
|
- !ruby/object:Gem::Dependency
|
104
82
|
name: citrus
|
105
|
-
requirement: &
|
83
|
+
requirement: &70288043589780 !ruby/object:Gem::Requirement
|
106
84
|
none: false
|
107
85
|
requirements:
|
108
86
|
- - ~>
|
@@ -110,10 +88,10 @@ dependencies:
|
|
110
88
|
version: 2.4.1
|
111
89
|
type: :runtime
|
112
90
|
prerelease: false
|
113
|
-
version_requirements: *
|
91
|
+
version_requirements: *70288043589780
|
114
92
|
- !ruby/object:Gem::Dependency
|
115
93
|
name: temple
|
116
|
-
requirement: &
|
94
|
+
requirement: &70288043609780 !ruby/object:Gem::Requirement
|
117
95
|
none: false
|
118
96
|
requirements:
|
119
97
|
- - ~>
|
@@ -121,47 +99,54 @@ dependencies:
|
|
121
99
|
version: 0.4.0
|
122
100
|
type: :runtime
|
123
101
|
prerelease: false
|
124
|
-
version_requirements: *
|
102
|
+
version_requirements: *70288043609780
|
125
103
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
127
|
-
requirement: &
|
104
|
+
name: quickl
|
105
|
+
requirement: &70288043609320 !ruby/object:Gem::Requirement
|
128
106
|
none: false
|
129
107
|
requirements:
|
130
108
|
- - ~>
|
131
109
|
- !ruby/object:Gem::Version
|
132
|
-
version:
|
110
|
+
version: 0.4.3
|
133
111
|
type: :runtime
|
134
112
|
prerelease: false
|
135
|
-
version_requirements: *
|
113
|
+
version_requirements: *70288043609320
|
136
114
|
- !ruby/object:Gem::Dependency
|
137
|
-
name:
|
138
|
-
requirement: &
|
115
|
+
name: awesome_print
|
116
|
+
requirement: &70288043608860 !ruby/object:Gem::Requirement
|
139
117
|
none: false
|
140
118
|
requirements:
|
141
119
|
- - ~>
|
142
120
|
- !ruby/object:Gem::Version
|
143
|
-
version: 0.
|
121
|
+
version: 1.0.2
|
144
122
|
type: :runtime
|
145
123
|
prerelease: false
|
146
|
-
version_requirements: *
|
124
|
+
version_requirements: *70288043608860
|
147
125
|
- !ruby/object:Gem::Dependency
|
148
|
-
name:
|
149
|
-
requirement: &
|
126
|
+
name: epath
|
127
|
+
requirement: &70288043608400 !ruby/object:Gem::Requirement
|
150
128
|
none: false
|
151
129
|
requirements:
|
152
|
-
- -
|
130
|
+
- - ! '>='
|
153
131
|
- !ruby/object:Gem::Version
|
154
|
-
version:
|
132
|
+
version: '0.2'
|
155
133
|
type: :runtime
|
156
134
|
prerelease: false
|
157
|
-
version_requirements: *
|
158
|
-
description: !
|
159
|
-
It's main aim is to
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
135
|
+
version_requirements: *70288043608400
|
136
|
+
description: ! 'WLang is a general-purpose *code generation*/*templating engine*.
|
137
|
+
It''s main aim is to
|
138
|
+
|
139
|
+
help you generating web pages, sql queries, ruby code (that is, generating text
|
140
|
+
in
|
141
|
+
|
142
|
+
general) without having to worry too much about html entities encoding, sql back
|
143
|
+
|
144
|
+
quoting, string escaping and the like. WLang proposes a generic engine that you
|
145
|
+
can
|
146
|
+
|
147
|
+
easily extend to fit your needs. It also proposes standard instantiations of this
|
148
|
+
|
149
|
+
engine for common tasks such as rendering HTML web pages.'
|
165
150
|
email:
|
166
151
|
- blambeau@gmail.com
|
167
152
|
- llambeau@gmail.com
|
@@ -191,20 +176,21 @@ files:
|
|
191
176
|
- lib/wlang/compiler/to_ruby_abstraction.rb
|
192
177
|
- lib/wlang/compiler/to_ruby_code.rb
|
193
178
|
- lib/wlang/compiler.rb
|
194
|
-
- lib/wlang/dialect/dispatching.rb
|
195
|
-
- lib/wlang/dialect/evaluation.rb
|
196
|
-
- lib/wlang/dialect/tags.rb
|
197
179
|
- lib/wlang/dialect.rb
|
198
180
|
- lib/wlang/dummy.rb
|
199
181
|
- lib/wlang/html.rb
|
200
182
|
- lib/wlang/loader.rb
|
201
|
-
- lib/wlang/mustang.rb
|
202
183
|
- lib/wlang/scope/binding_scope.rb
|
203
184
|
- lib/wlang/scope/object_scope.rb
|
185
|
+
- lib/wlang/scope/proc_scope.rb
|
204
186
|
- lib/wlang/scope/proxy_scope.rb
|
205
187
|
- lib/wlang/scope/root_scope.rb
|
206
188
|
- lib/wlang/scope.rb
|
189
|
+
- lib/wlang/source/front_matter.rb
|
190
|
+
- lib/wlang/source.rb
|
207
191
|
- lib/wlang/template.rb
|
192
|
+
- lib/wlang/tilt/wlang_template.rb
|
193
|
+
- lib/wlang/tilt.rb
|
208
194
|
- lib/wlang/version.rb
|
209
195
|
- lib/wlang.rb
|
210
196
|
- LICENCE.md
|
@@ -213,11 +199,15 @@ files:
|
|
213
199
|
- README.md
|
214
200
|
- spec/fixtures/dialect/foobar.rb
|
215
201
|
- spec/fixtures/dialect/upcasing.rb
|
216
|
-
- spec/fixtures/templates/hello.
|
217
|
-
- spec/
|
218
|
-
- spec/
|
219
|
-
- spec/
|
220
|
-
- spec/integration/examples/
|
202
|
+
- spec/fixtures/templates/hello.wlang
|
203
|
+
- spec/fixtures/templates/hello_with_data.wlang
|
204
|
+
- spec/fixtures/templates/hello_with_explicit_locals.wlang
|
205
|
+
- spec/fixtures/templates/hello_with_partials.wlang
|
206
|
+
- spec/integration/examples/1-html-intro/1-basics.md
|
207
|
+
- spec/integration/examples/1-html-intro/2-imperative.md
|
208
|
+
- spec/integration/examples/1-html-intro/3-partials.md
|
209
|
+
- spec/integration/examples/1-html-intro/4-recursion.md
|
210
|
+
- spec/integration/examples/1-html-intro/5-polymorphism.md
|
221
211
|
- spec/integration/html/test_ampersand.rb
|
222
212
|
- spec/integration/html/test_bang.rb
|
223
213
|
- spec/integration/html/test_caret.rb
|
@@ -231,9 +221,9 @@ files:
|
|
231
221
|
- spec/integration/html/test_star.rb
|
232
222
|
- spec/integration/test_dummy.rb
|
233
223
|
- spec/integration/test_examples.rb
|
234
|
-
- spec/integration/test_mustang.rb
|
235
224
|
- spec/integration/test_readme.rb
|
236
225
|
- spec/integration/test_upcasing.rb
|
226
|
+
- spec/integration/tilt/test_wlang_template.rb
|
237
227
|
- spec/spec_helper.rb
|
238
228
|
- spec/test_wlang.rb
|
239
229
|
- spec/unit/compiler/autospacing/test_right_strip.rb
|
@@ -246,19 +236,38 @@ files:
|
|
246
236
|
- spec/unit/compiler/test_strconcat_flattener.rb
|
247
237
|
- spec/unit/compiler/test_to_ruby_abstraction.rb
|
248
238
|
- spec/unit/compiler/test_to_ruby_code.rb
|
239
|
+
- spec/unit/compiler/test_to_ruby_proc.rb
|
249
240
|
- spec/unit/dialect/test_compile.rb
|
250
|
-
- spec/unit/dialect/test_dispatching.rb
|
251
241
|
- spec/unit/dialect/test_evaluate.rb
|
242
|
+
- spec/unit/dialect/test_new.rb
|
252
243
|
- spec/unit/dialect/test_render.rb
|
253
|
-
- spec/unit/dialect/
|
244
|
+
- spec/unit/dialect/test_tag.rb
|
245
|
+
- spec/unit/dialect/test_tag_dispatching_name.rb
|
254
246
|
- spec/unit/dialect/test_with_scope.rb
|
255
247
|
- spec/unit/scope/test_binding_scope.rb
|
248
|
+
- spec/unit/scope/test_chain.rb
|
256
249
|
- spec/unit/scope/test_coerce.rb
|
257
250
|
- spec/unit/scope/test_object_scope.rb
|
251
|
+
- spec/unit/scope/test_proc_scope.rb
|
258
252
|
- spec/unit/scope/test_proxy_scope.rb
|
259
253
|
- spec/unit/scope/test_root_scope.rb
|
254
|
+
- spec/unit/source/front_matter/test_locals.rb
|
255
|
+
- spec/unit/source/front_matter/test_template_content.rb
|
256
|
+
- spec/unit/source/test_locals.rb
|
257
|
+
- spec/unit/source/test_path.rb
|
258
|
+
- spec/unit/source/test_template_content.rb
|
259
|
+
- spec/unit/source/test_with_front_matter.rb
|
260
|
+
- spec/unit/template/test_call.rb
|
261
|
+
- spec/unit/template/test_new.rb
|
262
|
+
- spec/unit/template/test_path.rb
|
263
|
+
- spec/unit/template/test_render.rb
|
264
|
+
- spec/unit/template/test_to_ast.rb
|
265
|
+
- spec/unit/template/test_to_ruby_code.rb
|
266
|
+
- spec/unit/template/test_to_ruby_proc.rb
|
267
|
+
- spec/unit/template/test_yaml_front_matter.rb
|
260
268
|
- spec/unit/test_assumptions.rb
|
261
269
|
- spec/unit/test_scope.rb
|
270
|
+
- spec/unit/tilt/test_wlang_template.rb
|
262
271
|
- tasks/debug_mail.rake
|
263
272
|
- tasks/debug_mail.txt
|
264
273
|
- tasks/gem.rake
|
@@ -280,9 +289,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
280
289
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
281
290
|
none: false
|
282
291
|
requirements:
|
283
|
-
- - ! '
|
292
|
+
- - ! '>='
|
284
293
|
- !ruby/object:Gem::Version
|
285
|
-
version:
|
294
|
+
version: '0'
|
286
295
|
requirements: []
|
287
296
|
rubyforge_project:
|
288
297
|
rubygems_version: 1.8.10
|
@@ -292,11 +301,15 @@ summary: WLang is a powerful code generation and templating engine
|
|
292
301
|
test_files:
|
293
302
|
- spec/fixtures/dialect/foobar.rb
|
294
303
|
- spec/fixtures/dialect/upcasing.rb
|
295
|
-
- spec/fixtures/templates/hello.
|
296
|
-
- spec/
|
297
|
-
- spec/
|
298
|
-
- spec/
|
299
|
-
- spec/integration/examples/
|
304
|
+
- spec/fixtures/templates/hello.wlang
|
305
|
+
- spec/fixtures/templates/hello_with_data.wlang
|
306
|
+
- spec/fixtures/templates/hello_with_explicit_locals.wlang
|
307
|
+
- spec/fixtures/templates/hello_with_partials.wlang
|
308
|
+
- spec/integration/examples/1-html-intro/1-basics.md
|
309
|
+
- spec/integration/examples/1-html-intro/2-imperative.md
|
310
|
+
- spec/integration/examples/1-html-intro/3-partials.md
|
311
|
+
- spec/integration/examples/1-html-intro/4-recursion.md
|
312
|
+
- spec/integration/examples/1-html-intro/5-polymorphism.md
|
300
313
|
- spec/integration/html/test_ampersand.rb
|
301
314
|
- spec/integration/html/test_bang.rb
|
302
315
|
- spec/integration/html/test_caret.rb
|
@@ -310,9 +323,9 @@ test_files:
|
|
310
323
|
- spec/integration/html/test_star.rb
|
311
324
|
- spec/integration/test_dummy.rb
|
312
325
|
- spec/integration/test_examples.rb
|
313
|
-
- spec/integration/test_mustang.rb
|
314
326
|
- spec/integration/test_readme.rb
|
315
327
|
- spec/integration/test_upcasing.rb
|
328
|
+
- spec/integration/tilt/test_wlang_template.rb
|
316
329
|
- spec/spec_helper.rb
|
317
330
|
- spec/test_wlang.rb
|
318
331
|
- spec/unit/compiler/autospacing/test_right_strip.rb
|
@@ -325,16 +338,35 @@ test_files:
|
|
325
338
|
- spec/unit/compiler/test_strconcat_flattener.rb
|
326
339
|
- spec/unit/compiler/test_to_ruby_abstraction.rb
|
327
340
|
- spec/unit/compiler/test_to_ruby_code.rb
|
341
|
+
- spec/unit/compiler/test_to_ruby_proc.rb
|
328
342
|
- spec/unit/dialect/test_compile.rb
|
329
|
-
- spec/unit/dialect/test_dispatching.rb
|
330
343
|
- spec/unit/dialect/test_evaluate.rb
|
344
|
+
- spec/unit/dialect/test_new.rb
|
331
345
|
- spec/unit/dialect/test_render.rb
|
332
|
-
- spec/unit/dialect/
|
346
|
+
- spec/unit/dialect/test_tag.rb
|
347
|
+
- spec/unit/dialect/test_tag_dispatching_name.rb
|
333
348
|
- spec/unit/dialect/test_with_scope.rb
|
334
349
|
- spec/unit/scope/test_binding_scope.rb
|
350
|
+
- spec/unit/scope/test_chain.rb
|
335
351
|
- spec/unit/scope/test_coerce.rb
|
336
352
|
- spec/unit/scope/test_object_scope.rb
|
353
|
+
- spec/unit/scope/test_proc_scope.rb
|
337
354
|
- spec/unit/scope/test_proxy_scope.rb
|
338
355
|
- spec/unit/scope/test_root_scope.rb
|
356
|
+
- spec/unit/source/front_matter/test_locals.rb
|
357
|
+
- spec/unit/source/front_matter/test_template_content.rb
|
358
|
+
- spec/unit/source/test_locals.rb
|
359
|
+
- spec/unit/source/test_path.rb
|
360
|
+
- spec/unit/source/test_template_content.rb
|
361
|
+
- spec/unit/source/test_with_front_matter.rb
|
362
|
+
- spec/unit/template/test_call.rb
|
363
|
+
- spec/unit/template/test_new.rb
|
364
|
+
- spec/unit/template/test_path.rb
|
365
|
+
- spec/unit/template/test_render.rb
|
366
|
+
- spec/unit/template/test_to_ast.rb
|
367
|
+
- spec/unit/template/test_to_ruby_code.rb
|
368
|
+
- spec/unit/template/test_to_ruby_proc.rb
|
369
|
+
- spec/unit/template/test_yaml_front_matter.rb
|
339
370
|
- spec/unit/test_assumptions.rb
|
340
371
|
- spec/unit/test_scope.rb
|
372
|
+
- spec/unit/tilt/test_wlang_template.rb
|
@@ -1,51 +0,0 @@
|
|
1
|
-
module WLang
|
2
|
-
class Dialect
|
3
|
-
module Dispatching
|
4
|
-
|
5
|
-
module ClassMethods
|
6
|
-
|
7
|
-
def tag_dispatching_name(symbols, prefix = "_tag")
|
8
|
-
symbols = symbols.chars unless symbols.is_a?(Array)
|
9
|
-
chars = symbols.map{|s| s.ord}.join("_")
|
10
|
-
"#{prefix}_#{chars}".to_sym
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def define_tag_method(symbols, dialects, code)
|
16
|
-
rulename = tag_dispatching_name(symbols, "_tag")
|
17
|
-
case code
|
18
|
-
when Symbol
|
19
|
-
module_eval %Q{ alias :#{rulename} #{code} }
|
20
|
-
when Proc
|
21
|
-
define_method(rulename, code)
|
22
|
-
else
|
23
|
-
raise "Unable to use #{code} for a tag"
|
24
|
-
end
|
25
|
-
dialects_info_name = tag_dispatching_name(symbols, "_diatag")
|
26
|
-
define_method(dialects_info_name) do dialects end
|
27
|
-
end
|
28
|
-
|
29
|
-
end # module ClassMethods
|
30
|
-
|
31
|
-
module InstanceMethods
|
32
|
-
|
33
|
-
def dialects_for(symbols)
|
34
|
-
info = Dialect.tag_dispatching_name(symbols, "_diatag")
|
35
|
-
if respond_to?(info)
|
36
|
-
send(info)
|
37
|
-
else
|
38
|
-
raise ArgumentError, "No tag for #{symbols}"
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
end # module InstanceMethods
|
43
|
-
|
44
|
-
def self.included(mod)
|
45
|
-
mod.instance_eval{ include(Dispatching::InstanceMethods) }
|
46
|
-
mod.extend(ClassMethods)
|
47
|
-
end
|
48
|
-
|
49
|
-
end # module Dispatching
|
50
|
-
end # class Dialect
|
51
|
-
end # module WLang
|