wlang 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +7 -0
- data/Gemfile +2 -2
- data/Gemfile.lock +13 -18
- data/README.md +2 -4
- data/lib/wlang/dialect.rb +1 -1
- data/lib/wlang/html.rb +1 -1
- data/lib/wlang/scope/object_scope.rb +5 -1
- data/lib/wlang/source/front_matter.rb +1 -1
- data/lib/wlang/version.rb +1 -1
- data/spec/unit/source/front_matter/test_locals.rb +5 -0
- data/wlang.gemspec +1 -1
- data/wlang.noespec +2 -2
- metadata +6 -9
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# 2.2.1 / 2013-04-29
|
2
|
+
|
3
|
+
* Enhanced Scope#to_s for readability of error messages.
|
4
|
+
* Fix >{...} where the Html dialect is subclassed, the partial is not
|
5
|
+
correctly compiled with the subclass.
|
6
|
+
* Fixed a bug when YAML front matter is empty in templates.
|
7
|
+
|
1
8
|
# 2.2.0 / 2013-03-05
|
2
9
|
|
3
10
|
* Added ATTR/VALUE pairs to the wlang command line tool, for passing data to templates
|
data/Gemfile
CHANGED
@@ -17,6 +17,6 @@ group :development do
|
|
17
17
|
gem "rake", "~> 0.9.2"
|
18
18
|
gem "bundler", "~> 1.0"
|
19
19
|
gem "rspec", "~> 2.10.0"
|
20
|
-
gem "sinatra",
|
21
|
-
gem "rack-test", "~> 0.6
|
20
|
+
gem "sinatra", ">= 1.4"
|
21
|
+
gem "rack-test", "~> 0.6"
|
22
22
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,27 +1,18 @@
|
|
1
|
-
GIT
|
2
|
-
remote: git://github.com/sinatra/sinatra
|
3
|
-
revision: 8752085a05c33edd13d3ec8d3187d1406456d404
|
4
|
-
specs:
|
5
|
-
sinatra (1.4.0)
|
6
|
-
rack (~> 1.3, >= 1.3.6)
|
7
|
-
rack-protection (~> 1.2)
|
8
|
-
tilt (~> 1.3, >= 1.3.3)
|
9
|
-
|
10
1
|
GEM
|
11
2
|
remote: http://rubygems.org/
|
12
3
|
specs:
|
13
4
|
awesome_print (1.0.2)
|
14
|
-
backports (2.
|
5
|
+
backports (2.8.2)
|
15
6
|
citrus (2.4.1)
|
16
7
|
diff-lcs (1.1.3)
|
17
8
|
path (1.3.1)
|
18
9
|
quickl (0.4.3)
|
19
|
-
rack (1.
|
20
|
-
rack-protection (1.
|
10
|
+
rack (1.5.2)
|
11
|
+
rack-protection (1.5.0)
|
21
12
|
rack
|
22
|
-
rack-test (0.6.
|
13
|
+
rack-test (0.6.2)
|
23
14
|
rack (>= 1.0)
|
24
|
-
rake (0.9.
|
15
|
+
rake (0.9.6)
|
25
16
|
rspec (2.10.0)
|
26
17
|
rspec-core (~> 2.10.0)
|
27
18
|
rspec-expectations (~> 2.10.0)
|
@@ -30,8 +21,12 @@ GEM
|
|
30
21
|
rspec-expectations (2.10.0)
|
31
22
|
diff-lcs (~> 1.1.3)
|
32
23
|
rspec-mocks (2.10.1)
|
33
|
-
|
34
|
-
|
24
|
+
sinatra (1.4.2)
|
25
|
+
rack (~> 1.5, >= 1.5.2)
|
26
|
+
rack-protection (~> 1.4)
|
27
|
+
tilt (~> 1.3, >= 1.3.4)
|
28
|
+
temple (0.4.1)
|
29
|
+
tilt (1.3.7)
|
35
30
|
|
36
31
|
PLATFORMS
|
37
32
|
ruby
|
@@ -43,9 +38,9 @@ DEPENDENCIES
|
|
43
38
|
citrus (~> 2.4.1)
|
44
39
|
path (~> 1.3)
|
45
40
|
quickl (~> 0.4.3)
|
46
|
-
rack-test (~> 0.6
|
41
|
+
rack-test (~> 0.6)
|
47
42
|
rake (~> 0.9.2)
|
48
43
|
rspec (~> 2.10.0)
|
49
|
-
sinatra
|
44
|
+
sinatra (>= 1.4)
|
50
45
|
temple (~> 0.4.0)
|
51
46
|
tilt (~> 1.3)
|
data/README.md
CHANGED
@@ -4,8 +4,6 @@
|
|
4
4
|
|
5
5
|
WLang is a powerful code generation and templating engine, implemented on top of [temple](https://github.com/judofyr/temple) and much inspired by the excellent [mustache](http://mustache.github.com/).
|
6
6
|
|
7
|
-
**WLang2 is still work in progress**.
|
8
|
-
|
9
7
|
## Links
|
10
8
|
|
11
9
|
* http://github.com/blambeau/wlang
|
@@ -31,7 +29,7 @@ WLang is a templating engine, written in ruby. In that, it is similar to ERB, Mu
|
|
31
29
|
|
32
30
|
```ruby
|
33
31
|
WLang::Html.render 'Hello to ${who}!', who: 'you & the world'
|
34
|
-
# => "Hello you & the world!"
|
32
|
+
# => "Hello to you & the world!"
|
35
33
|
```
|
36
34
|
|
37
35
|
To output HTML pages, WLang does not provides you with killer features or extraordinary shortcus. It supports escaping, as shown above, but many other templating engines do. For such HTML tasks, WLang does a pretty good job but many other engines perform faster and have nicer features. See the examples folder that documents WLang::Html.
|
@@ -76,7 +74,7 @@ Please note that you should require tilt first, then wlang. Otherwise, you'll ha
|
|
76
74
|
|
77
75
|
# Sinatra integration
|
78
76
|
|
79
|
-
WLang comes bundled with built-in support for [Sinatra](https://github.com/sinatra/sinatra). As usual in Sinatra, you can simply invoke wlang as follows:
|
77
|
+
WLang comes bundled with built-in support for [Sinatra](https://github.com/sinatra/sinatra) >= 1.4 (release still in progress). As usual in Sinatra, you can simply invoke wlang as follows:
|
80
78
|
|
81
79
|
get '/' do
|
82
80
|
wlang :index, :locals => { ... }
|
data/lib/wlang/dialect.rb
CHANGED
@@ -186,7 +186,7 @@ module WLang
|
|
186
186
|
catch(:fail) do
|
187
187
|
return scope.evaluate(expr, self, *default, &bl)
|
188
188
|
end
|
189
|
-
raise NameError, "Unable to find `#{expr}`"
|
189
|
+
raise NameError, "Unable to find `#{expr}` on #{scope}"
|
190
190
|
else
|
191
191
|
evaluate(render(expr), *default, &bl)
|
192
192
|
end
|
data/lib/wlang/html.rb
CHANGED
@@ -26,10 +26,14 @@ module WLang
|
|
26
26
|
safe_parent.fetch(key, dialect, unfound)
|
27
27
|
end
|
28
28
|
|
29
|
+
def to_s
|
30
|
+
subj = subject.is_a?(Scope) ? subject.to_s : subject.class
|
31
|
+
"ObjectScope(#{subj})"
|
32
|
+
end
|
33
|
+
|
29
34
|
def inspect
|
30
35
|
"ObjectScope(#{subject.inspect})"
|
31
36
|
end
|
32
|
-
alias :to_s :inspect
|
33
37
|
|
34
38
|
end # class ProxyScope
|
35
39
|
end # class Scope
|
data/lib/wlang/version.rb
CHANGED
@@ -12,6 +12,11 @@ module WLang
|
|
12
12
|
it{ should eq({}) }
|
13
13
|
end
|
14
14
|
|
15
|
+
context 'with an empty front matter' do
|
16
|
+
let(:source){ "---\n---\nHello world!" }
|
17
|
+
it{ should eq({}) }
|
18
|
+
end
|
19
|
+
|
15
20
|
describe 'with a front matter' do
|
16
21
|
let(:source){ "---\nlocals:\n x: 2\n---\nHello world!" }
|
17
22
|
specify 'it decode the YAML data' do
|
data/wlang.gemspec
CHANGED
@@ -129,7 +129,7 @@ Gem::Specification.new do |s|
|
|
129
129
|
s.add_development_dependency("bundler", "~> 1.0")
|
130
130
|
s.add_development_dependency("rspec", "~> 2.10.0")
|
131
131
|
s.add_development_dependency("sinatra", ">= 1.4")
|
132
|
-
s.add_development_dependency("rack-test", "~> 0.6
|
132
|
+
s.add_development_dependency("rack-test", "~> 0.6")
|
133
133
|
s.add_dependency("citrus", "~> 2.4.1")
|
134
134
|
s.add_dependency("temple", "~> 0.4.0")
|
135
135
|
s.add_dependency("quickl", "~> 0.4.3")
|
data/wlang.noespec
CHANGED
@@ -12,7 +12,7 @@ variables:
|
|
12
12
|
upper:
|
13
13
|
WLang
|
14
14
|
version:
|
15
|
-
2.2.
|
15
|
+
2.2.1
|
16
16
|
summary: |-
|
17
17
|
WLang is a powerful code generation and templating engine
|
18
18
|
description: |-
|
@@ -42,4 +42,4 @@ variables:
|
|
42
42
|
- {name: bundler, version: "~> 1.0", groups: [development]}
|
43
43
|
- {name: rspec, version: "~> 2.10.0", groups: [development]}
|
44
44
|
- {name: sinatra, version: ">= 1.4", groups: [development]}
|
45
|
-
- {name: rack-test, version: "~> 0.6
|
45
|
+
- {name: rack-test, version: "~> 0.6", groups: [development]}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wlang
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-04-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: awesome_print
|
@@ -115,7 +115,7 @@ dependencies:
|
|
115
115
|
requirements:
|
116
116
|
- - ~>
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version: 0.6
|
118
|
+
version: '0.6'
|
119
119
|
type: :development
|
120
120
|
prerelease: false
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -123,7 +123,7 @@ dependencies:
|
|
123
123
|
requirements:
|
124
124
|
- - ~>
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version: 0.6
|
126
|
+
version: '0.6'
|
127
127
|
- !ruby/object:Gem::Dependency
|
128
128
|
name: citrus
|
129
129
|
requirement: !ruby/object:Gem::Requirement
|
@@ -366,19 +366,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
366
366
|
version: '0'
|
367
367
|
segments:
|
368
368
|
- 0
|
369
|
-
hash:
|
369
|
+
hash: 1908849138847270231
|
370
370
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
371
371
|
none: false
|
372
372
|
requirements:
|
373
373
|
- - ! '>='
|
374
374
|
- !ruby/object:Gem::Version
|
375
375
|
version: '0'
|
376
|
-
segments:
|
377
|
-
- 0
|
378
|
-
hash: 1035684278937019643
|
379
376
|
requirements: []
|
380
377
|
rubyforge_project:
|
381
|
-
rubygems_version: 1.8.
|
378
|
+
rubygems_version: 1.8.25
|
382
379
|
signing_key:
|
383
380
|
specification_version: 3
|
384
381
|
summary: WLang is a powerful code generation and templating engine
|