feather 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +5 -0
- data/README.md +1 -1
- data/VERSION +1 -1
- data/feather.gemspec +54 -0
- data/lib/feather.rb +2 -0
- data/lib/feather/support.rb +2 -0
- data/lib/feather/template.rb +3 -1
- data/test/test_feather_support.rb +1 -0
- data/test/test_feather_template.rb +1 -0
- metadata +4 -2
data/Gemfile
ADDED
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/feather.gemspec
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "feather"
|
8
|
+
s.version = "0.3.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Scott Tadman"]
|
12
|
+
s.date = "2013-01-25"
|
13
|
+
s.description = "A simple light-weight text templating system"
|
14
|
+
s.email = "github@tadman.ca"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"Gemfile",
|
22
|
+
"LICENSE.txt",
|
23
|
+
"README.md",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"feather.gemspec",
|
27
|
+
"lib/feather.rb",
|
28
|
+
"lib/feather/support.rb",
|
29
|
+
"lib/feather/template.rb",
|
30
|
+
"notes/example.ft",
|
31
|
+
"test/helper.rb",
|
32
|
+
"test/test_feather.rb",
|
33
|
+
"test/test_feather_support.rb",
|
34
|
+
"test/test_feather_template.rb"
|
35
|
+
]
|
36
|
+
s.homepage = "http://github.com/twg/feather"
|
37
|
+
s.licenses = ["MIT"]
|
38
|
+
s.require_paths = ["lib"]
|
39
|
+
s.rubygems_version = "1.8.24"
|
40
|
+
s.summary = "Light-weight text tempating system"
|
41
|
+
|
42
|
+
if s.respond_to? :specification_version then
|
43
|
+
s.specification_version = 3
|
44
|
+
|
45
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
46
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
47
|
+
else
|
48
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
49
|
+
end
|
50
|
+
else
|
51
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
data/lib/feather.rb
CHANGED
@@ -4,6 +4,8 @@ module Feather
|
|
4
4
|
autoload(:Support, 'feather/support')
|
5
5
|
autoload(:Template, 'feather/template')
|
6
6
|
|
7
|
+
# == Module Methods =======================================================
|
8
|
+
|
7
9
|
def self.version
|
8
10
|
@version ||= File.readlines(
|
9
11
|
File.expand_path('../VERSION', File.dirname(__FILE__))
|
data/lib/feather/support.rb
CHANGED
data/lib/feather/template.rb
CHANGED
@@ -81,6 +81,8 @@ class Feather::Template
|
|
81
81
|
v
|
82
82
|
when TOKEN_TRIGGER
|
83
83
|
self.class.new(v, :escape => @escape_method)
|
84
|
+
when nil
|
85
|
+
nil
|
84
86
|
else
|
85
87
|
v.to_s
|
86
88
|
end
|
@@ -206,7 +208,7 @@ class Feather::Template
|
|
206
208
|
|
207
209
|
variables and variables[tag] = true
|
208
210
|
when '*'
|
209
|
-
source and source << "_t=t&&t[#{tag.inspect}];r<<(_t.respond_to?(:call)?_t.call(v,t):_t.to_s);"
|
211
|
+
source and source << "_t=t&&(t[#{tag.inspect}]||t[#{tag.to_s.inspect}]);r<<(_t.respond_to?(:call)?_t.call(v,t):_t.to_s);"
|
210
212
|
|
211
213
|
templates and templates[tag] = true
|
212
214
|
when '/'
|
@@ -13,6 +13,7 @@ class TestFeatherSupport < Test::Unit::TestCase
|
|
13
13
|
assert_equal 'a', variables[:test][0][:a]
|
14
14
|
assert_equal 'b', variables[:test][0][:b]
|
15
15
|
assert_equal 'c', variables[:test][1][:c]
|
16
|
+
assert_equal nil, variables[:test][1][:d]
|
16
17
|
|
17
18
|
test = { 'test' => [ { 'a' => :a, 'b' => :b }, { 'c' => :c } ] }
|
18
19
|
|
@@ -94,6 +94,7 @@ class TestFeatherTemplate < Test::Unit::TestCase
|
|
94
94
|
template = Feather::Template.new('{{*example}}', :escape => :html)
|
95
95
|
|
96
96
|
assert_equal 'child', template.render(nil, { :example => '{{*parent}}', :parent => 'child' }.freeze)
|
97
|
+
assert_equal 'child', template.render(nil, { 'example' => '{{*parent}}', 'parent' => 'child' }.freeze)
|
97
98
|
end
|
98
99
|
|
99
100
|
def test_dynamic_variables
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feather
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jeweler
|
@@ -36,10 +36,12 @@ extra_rdoc_files:
|
|
36
36
|
- README.md
|
37
37
|
files:
|
38
38
|
- .document
|
39
|
+
- Gemfile
|
39
40
|
- LICENSE.txt
|
40
41
|
- README.md
|
41
42
|
- Rakefile
|
42
43
|
- VERSION
|
44
|
+
- feather.gemspec
|
43
45
|
- lib/feather.rb
|
44
46
|
- lib/feather/support.rb
|
45
47
|
- lib/feather/template.rb
|