temple 0.5.5 → 0.6.0
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/.travis.yml +5 -1
- data/CHANGES +5 -0
- data/README.md +2 -2
- data/kill-travis.sh +16 -0
- data/lib/temple/html/attribute_merger.rb +3 -3
- data/lib/temple/html/fast.rb +4 -4
- data/lib/temple/mixins/options.rb +2 -2
- data/lib/temple/version.rb +1 -1
- data/test/html/test_fast.rb +3 -3
- metadata +4 -2
data/.travis.yml
CHANGED
data/CHANGES
CHANGED
data/README.md
CHANGED
@@ -246,10 +246,10 @@ as following:
|
|
246
246
|
Engines using Temple
|
247
247
|
--------------------
|
248
248
|
|
249
|
-
*
|
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 :
|
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[:
|
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[:
|
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
|
data/lib/temple/html/fast.rb
CHANGED
@@ -22,7 +22,7 @@ module Temple
|
|
22
22
|
}.freeze
|
23
23
|
|
24
24
|
define_options :format => :xhtml,
|
25
|
-
:
|
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[:
|
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[:
|
91
|
+
[:static, " #{name}=#{options[:attr_quote]}"],
|
92
92
|
compile(value),
|
93
|
-
[:static, options[:
|
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
|
-
|
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
|
-
|
18
|
+
warn "Option #{key.inspect} is not supported by #{self}"
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
data/lib/temple/version.rb
CHANGED
data/test/html/test_fast.rb
CHANGED
@@ -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
|
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
|
65
|
-
[:multi, [:static, " class
|
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.
|
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:
|
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:
|