feather 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source :rubygems
2
+
3
+ group :development do
4
+ gem 'jeweler'
5
+ end
data/README.md CHANGED
@@ -47,6 +47,6 @@ as a reference.
47
47
 
48
48
  ## Copyright
49
49
 
50
- Copyright (c) 2011-2012 Scott Tadman, The Working Group Inc.
50
+ Copyright (c) 2011-2013 Scott Tadman, The Working Group Inc.
51
51
  See LICENSE.txt for further details.
52
52
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -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
+
@@ -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__))
@@ -2,6 +2,8 @@ require 'uri'
2
2
  require 'cgi'
3
3
 
4
4
  module Feather::Support
5
+ # == Module/Mixin Methods =================================================
6
+
5
7
  def uri_escape(object)
6
8
  URI.escape(object.to_s, /[^a-z0-9\-\.]/i)
7
9
  end
@@ -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.0
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: 2012-12-13 00:00:00.000000000 Z
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