wlang 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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", :git => "git://github.com/sinatra/sinatra" #">= 1.4"
21
- gem "rack-test", "~> 0.6.1"
20
+ gem "sinatra", ">= 1.4"
21
+ gem "rack-test", "~> 0.6"
22
22
  end
@@ -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.6.1)
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.4.1)
20
- rack-protection (1.2.0)
10
+ rack (1.5.2)
11
+ rack-protection (1.5.0)
21
12
  rack
22
- rack-test (0.6.1)
13
+ rack-test (0.6.2)
23
14
  rack (>= 1.0)
24
- rake (0.9.2.2)
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
- temple (0.4.0)
34
- tilt (1.3.3)
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.1)
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 => { ... }
@@ -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
@@ -71,7 +71,7 @@ module WLang
71
71
 
72
72
  def greater(buf, fn)
73
73
  val = evaluate(fn)
74
- val = Html.compile(val) if String === val
74
+ val = self.class.compile(val) if String === val
75
75
  val = val.call if Proc === val and val.arity<=0
76
76
  render(val, nil, buf)
77
77
  end
@@ -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
@@ -27,7 +27,7 @@ module WLang
27
27
  @locals, @template_content = {}, $'
28
28
 
29
29
  require 'yaml'
30
- yaml = YAML::load($1)
30
+ yaml = YAML::load($1) || {}
31
31
 
32
32
  # append explicit locals
33
33
  @locals.merge!(yaml.delete("locals") || {})
@@ -3,7 +3,7 @@ module WLang
3
3
 
4
4
  MAJOR = 2
5
5
  MINOR = 2
6
- TINY = 0
6
+ TINY = 1
7
7
 
8
8
  def self.to_s
9
9
  [ MAJOR, MINOR, TINY ].join('.')
@@ -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
@@ -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.1")
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")
@@ -12,7 +12,7 @@ variables:
12
12
  upper:
13
13
  WLang
14
14
  version:
15
- 2.2.0
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.1", groups: [development]}
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.0
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-03-05 00:00:00.000000000 Z
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.1
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.1
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: 1035684278937019643
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.24
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