temple 0.7.3 → 0.7.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a5698e0987714d41aa759069655a1c276a5aab1
4
- data.tar.gz: 58ae7b8dca8c28264ae03e9136e017f8a6c2efbe
3
+ metadata.gz: 817a4564ae590c547798aa08afb03e970c7a1be0
4
+ data.tar.gz: 2d7de8792d73a9d207488a04f93f2cf52adbfdb7
5
5
  SHA512:
6
- metadata.gz: b50a65d9d25973bf7470b3cc5d835bce94ff386e886570a3b6d9412b3aea312bf791bc70a6203025515a902dbe25a554d9ecf7f7ea81dcdf16322d6997e3b06a
7
- data.tar.gz: c2e805cd2ba16d0a27af4686f0b50df4f2013b4ad146284ba952b1fe0146d4ff31d4c3954655d979ffb907b0c4eb1a4e1b81f966dbd96a5756ebc35115c80b49
6
+ metadata.gz: e96b8d1ff3cc0dd3b09c108ef167440bc5cb1229b7b66810e5ecec85c55de1ddf51c3a3548f960e2ebe51ed0dc93a1746dca8146cb44a700264287d1ea7c5535
7
+ data.tar.gz: 721be6c7597a773ac7ede0f9f7dba71dc61695c3a52805dc1580dc1aca9615698a621eaefc726311083ebd16afaff38ec9ebd856dd599ae78f4c71196486c4af
data/CHANGES CHANGED
@@ -1,3 +1,8 @@
1
+ 0.7.4
2
+
3
+ * EngineDSL: allow to replace/remove with regexp
4
+ * Fix deprecation warning (#83)
5
+
1
6
  0.7.3
2
7
 
3
8
  * Temple::ERB::Trimming - replace option trim_mode with trim and switch to erubis-like trimming
@@ -38,8 +38,8 @@ module Temple
38
38
  @format = options[:format]
39
39
  unless [:xhtml, :html, :xml].include?(@format)
40
40
  if @format == :html4 || @format == :html5
41
- @format = :html
42
41
  warn "Format #{@format.inspect} is deprecated, use :html"
42
+ @format = :html
43
43
  else
44
44
  raise ArgumentError, "Invalid format #{@format.inspect}"
45
45
  end
@@ -17,7 +17,7 @@ module Temple
17
17
 
18
18
  def remove(name)
19
19
  name = chain_name(name)
20
- raise "#{name} not found" unless chain.reject! {|i| i.first == name }
20
+ raise "#{name} not found" unless chain.reject! {|i| name === i.first }
21
21
  chain_modified!
22
22
  end
23
23
 
@@ -26,7 +26,7 @@ module Temple
26
26
  def before(name, *args, &block)
27
27
  name = chain_name(name)
28
28
  e = chain_element(args, block)
29
- chain.map! {|f| f.first == name ? [e, f] : [f] }.flatten!(1)
29
+ chain.map! {|f| name === f.first ? [e, f] : [f] }.flatten!(1)
30
30
  raise "#{name} not found" unless chain.include?(e)
31
31
  chain_modified!
32
32
  end
@@ -34,7 +34,7 @@ module Temple
34
34
  def after(name, *args, &block)
35
35
  name = chain_name(name)
36
36
  e = chain_element(args, block)
37
- chain.map! {|f| f.first == name ? [f, e] : [f] }.flatten!(1)
37
+ chain.map! {|f| name === f.first ? [f, e] : [f] }.flatten!(1)
38
38
  raise "#{name} not found" unless chain.include?(e)
39
39
  chain_modified!
40
40
  end
@@ -42,7 +42,7 @@ module Temple
42
42
  def replace(name, *args, &block)
43
43
  name = chain_name(name)
44
44
  e = chain_element(args, block)
45
- chain.map! {|f| f.first == name ? e : f }
45
+ chain.map! {|f| name === f.first ? e : f }
46
46
  raise "#{name} not found" unless chain.include?(e)
47
47
  chain_modified!
48
48
  end
@@ -59,9 +59,16 @@ module Temple
59
59
  private
60
60
 
61
61
  def chain_name(name)
62
- name = Class === name ? name.name.to_sym : name
63
- raise(ArgumentError, 'Name argument must be Class or Symbol') unless Symbol === name
64
- name
62
+ case name
63
+ when Class
64
+ name.name.to_sym
65
+ when Symbol, String
66
+ name.to_sym
67
+ when Regexp
68
+ name
69
+ else
70
+ raise(ArgumentError, 'Name argument must be Class, Symbol, String or Regexp')
71
+ end
65
72
  end
66
73
 
67
74
  def chain_class_constructor(filter, local_options)
@@ -1,3 +1,3 @@
1
1
  module Temple
2
- VERSION = '0.7.3'
2
+ VERSION = '0.7.4'
3
3
  end
@@ -147,6 +147,10 @@ describe Temple::Engine do
147
147
  engine.chain.size.should.equal 7
148
148
  engine.chain[0].first.should.equal :Parser
149
149
  engine.chain[1].first.should.equal :MyFilter2
150
+
151
+ engine = TestEngine.new
152
+ engine.remove /Last/
153
+ engine.chain.size.should.equal 6
150
154
  end
151
155
 
152
156
  it 'should have #replace' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: temple
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Magnus Holm
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-07 00:00:00.000000000 Z
12
+ date: 2014-12-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: tilt
@@ -176,5 +176,26 @@ rubygems_version: 2.2.2
176
176
  signing_key:
177
177
  specification_version: 4
178
178
  summary: Template compilation framework in Ruby
179
- test_files: []
180
- has_rdoc:
179
+ test_files:
180
+ - test/filters/test_code_merger.rb
181
+ - test/filters/test_control_flow.rb
182
+ - test/filters/test_dynamic_inliner.rb
183
+ - test/filters/test_eraser.rb
184
+ - test/filters/test_escapable.rb
185
+ - test/filters/test_multi_flattener.rb
186
+ - test/filters/test_static_merger.rb
187
+ - test/helper.rb
188
+ - test/html/test_attribute_merger.rb
189
+ - test/html/test_attribute_remover.rb
190
+ - test/html/test_attribute_sorter.rb
191
+ - test/html/test_fast.rb
192
+ - test/html/test_pretty.rb
193
+ - test/mixins/test_dispatcher.rb
194
+ - test/mixins/test_grammar_dsl.rb
195
+ - test/test_engine.rb
196
+ - test/test_erb.rb
197
+ - test/test_filter.rb
198
+ - test/test_generator.rb
199
+ - test/test_grammar.rb
200
+ - test/test_map.rb
201
+ - test/test_utils.rb