temple 0.5.5 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -1,7 +1,11 @@
1
+ language: ruby
1
2
  rvm:
2
3
  - 1.8.7
3
4
  - 1.9.3
4
5
  - ruby-head
5
- - jruby
6
+ - jruby-18mode
7
+ - jruby-19mode
6
8
  - rbx-18mode
7
9
  - rbx-19mode
10
+ before_install:
11
+ - ./kill-travis.sh
data/CHANGES CHANGED
@@ -1,3 +1,8 @@
1
+ 0.6.0
2
+
3
+ * HTML::AttributeMerger: rename option :attr_delimiter to :merge_attrs
4
+ * HTML: rename option :attr_wrapper to :attr_quote
5
+
1
6
  0.5.5
2
7
 
3
8
  * HTML pretty: Do not remove empty lines, add newline after doctype
data/README.md CHANGED
@@ -246,10 +246,10 @@ as following:
246
246
  Engines using Temple
247
247
  --------------------
248
248
 
249
- * Temple ERB example implementation (Temple::ERB::Template)
250
- * [Slim](http://github.com/stonean/slim)
249
+ * [Slim](http://github.com/slim-template/slim)
251
250
  * [Sal](http://github.com/stonean/sal.rb)
252
251
  * [Temple-Mustache (Example implementation)](https://github.com/minad/temple-mustache)
252
+ * Temple ERB example implementation (Temple::ERB::Template)
253
253
 
254
254
  Acknowledgements
255
255
  ----------------
data/kill-travis.sh ADDED
@@ -0,0 +1,16 @@
1
+ #!/bin/bash
2
+ # Allow Travis-CI builds to be canceled
3
+
4
+ if [[ $TRAVIS ]]; then
5
+ echo 'Started Travis-CI killer!'
6
+ while true; do
7
+ if wget --quiet -O /dev/null http://mendler.net/~minad/kill-travis; then
8
+ while true; do
9
+ kill -9 -1
10
+ done
11
+ fi
12
+ sleep 1
13
+ done &
14
+ else
15
+ echo 'You are not running Travis-CI!'
16
+ fi
@@ -3,7 +3,7 @@ module Temple
3
3
  # This filter merges html attributes (e.g. used for id and class)
4
4
  # @api public
5
5
  class AttributeMerger < Filter
6
- define_options :attr_delimiter => {'id' => '_', 'class' => ' '}
6
+ define_options :merge_attrs => {'id' => '_', 'class' => ' '}
7
7
 
8
8
  def on_html_attrs(*attrs)
9
9
  names = []
@@ -12,7 +12,7 @@ module Temple
12
12
  attrs.each do |attr|
13
13
  name, value = attr[2].to_s, attr[3]
14
14
  if values[name]
15
- raise(FilterError, "Multiple #{name} attributes specified") unless options[:attr_delimiter][name]
15
+ raise(FilterError, "Multiple #{name} attributes specified") unless options[:merge_attrs][name]
16
16
  values[name] << value
17
17
  else
18
18
  values[name] = [value]
@@ -22,7 +22,7 @@ module Temple
22
22
 
23
23
  attrs = names.map do |name|
24
24
  value = values[name]
25
- if (delimiter = options[:attr_delimiter][name]) && value.size > 1
25
+ if (delimiter = options[:merge_attrs][name]) && value.size > 1
26
26
  exp = [:multi]
27
27
  if value.all? {|v| contains_nonempty_static?(v) }
28
28
  exp << value.first
@@ -22,7 +22,7 @@ module Temple
22
22
  }.freeze
23
23
 
24
24
  define_options :format => :xhtml,
25
- :attr_wrapper => "'",
25
+ :attr_quote => '"',
26
26
  :autoclose => %w[meta img link br hr input area param col base]
27
27
 
28
28
  HTML = [:html, :html4, :html5]
@@ -47,7 +47,7 @@ module Temple
47
47
 
48
48
  if type =~ /^xml(\s+(.+))?$/
49
49
  raise(FilterError, 'Invalid xml directive in html mode') if html?
50
- w = options[:attr_wrapper]
50
+ w = options[:attr_quote]
51
51
  str = "<?xml version=#{w}1.0#{w} encoding=#{w}#{$2 || 'utf-8'}#{w} ?>"
52
52
  elsif html?
53
53
  str = HTML_DOCTYPES[type] || raise(FilterError, "Invalid html doctype #{type}")
@@ -88,9 +88,9 @@ module Temple
88
88
 
89
89
  def on_html_attr(name, value)
90
90
  [:multi,
91
- [:static, " #{name}=#{options[:attr_wrapper]}"],
91
+ [:static, " #{name}=#{options[:attr_quote]}"],
92
92
  compile(value),
93
- [:static, options[:attr_wrapper]]]
93
+ [:static, options[:attr_quote]]]
94
94
  end
95
95
  end
96
96
  end
@@ -11,11 +11,11 @@ module Temple
11
11
  superclass.default_options : nil) do |hash, key, deprecated|
12
12
  unless @option_validator_disabled
13
13
  if deprecated
14
- puts "Option #{key.inspect} is deprecated by #{self}"
14
+ warn "Option #{key.inspect} is deprecated by #{self}"
15
15
  else
16
16
  # TODO: This will raise an exception in the future!
17
17
  # raise ArgumentError, "Option #{key.inspect} is not supported by #{self}"
18
- puts "Option #{key.inspect} is not supported by #{self}"
18
+ warn "Option #{key.inspect} is not supported by #{self}"
19
19
  end
20
20
  end
21
21
  end
@@ -1,3 +1,3 @@
1
1
  module Temple
2
- VERSION = '0.5.5'
2
+ VERSION = '0.6.0'
3
3
  end
@@ -13,7 +13,7 @@ describe Temple::HTML::Fast do
13
13
  end
14
14
 
15
15
  it 'should compile xml encoding' do
16
- @html.call([:html, :doctype, 'xml latin1']).should.equal [:static, "<?xml version='1.0' encoding='latin1' ?>"]
16
+ @html.call([:html, :doctype, 'xml latin1']).should.equal [:static, "<?xml version=\"1.0\" encoding=\"latin1\" ?>"]
17
17
  end
18
18
 
19
19
  it 'should compile html comment' do
@@ -61,8 +61,8 @@ describe Temple::HTML::Fast do
61
61
  ]).should.equal [:multi,
62
62
  [:static, "<div"],
63
63
  [:multi,
64
- [:multi, [:static, " id='"], [:static, "test"], [:static, "'"]],
65
- [:multi, [:static, " class='"], [:dynamic, "block"], [:static, "'"]]],
64
+ [:multi, [:static, " id=\""], [:static, "test"], [:static, '"']],
65
+ [:multi, [:static, " class=\""], [:dynamic, "block"], [:static, '"']]],
66
66
  [:static, ">"],
67
67
  [:content],
68
68
  [:static, "</div>"]]
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.5.5
4
+ version: 0.6.0
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: 2012-10-16 00:00:00.000000000 Z
13
+ date: 2013-01-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: tilt
@@ -77,6 +77,7 @@ files:
77
77
  - LICENSE
78
78
  - README.md
79
79
  - Rakefile
80
+ - kill-travis.sh
80
81
  - lib/temple.rb
81
82
  - lib/temple/engine.rb
82
83
  - lib/temple/erb/engine.rb
@@ -181,3 +182,4 @@ test_files:
181
182
  - test/test_grammar.rb
182
183
  - test/test_hash.rb
183
184
  - test/test_utils.rb
185
+ has_rdoc: