slim 3.0.2 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +4 -0
- data/README.jp.md +2 -2
- data/README.md +2 -2
- data/lib/slim/splat/builder.rb +22 -3
- data/lib/slim/splat/filter.rb +1 -1
- data/lib/slim/version.rb +1 -1
- data/test/rails/app/views/slim/splat.html.slim +2 -0
- data/test/rails/test/test_slim.rb +5 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3526425b78d5829bd231ac9a41146c6044b093d3
|
4
|
+
data.tar.gz: fe4ab15abda376d89008704a2956e2c5e7050f99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa521d0745c0b0a404c512fc22a9dd69643efcfec0827e500ef6b5ad183ef9fdda8a163550ece9ae9d2d7ecbddd3ac32fa13a0edcfdaf824bd4076950c9eb6d4
|
7
|
+
data.tar.gz: caacf25c2529313fbf6aad2de36e6f5186de76b873819d214f39d982d3e91da7105f1d46ddf144e852f25a53f040ac20c3d8a45ea60c1abcba1967bfd3955b4a
|
data/CHANGES
CHANGED
data/README.jp.md
CHANGED
@@ -33,8 +33,8 @@ Slim は 不可解にならないように view の構文を本質的な部品
|
|
33
33
|
* バグ: <http://github.com/slim-template/slim/issues>
|
34
34
|
* リスト: <http://groups.google.com/group/slim-template>
|
35
35
|
* API ドキュメント:
|
36
|
-
* 最新の Gem: <http://rubydoc.info/gems/slim/frames>
|
37
|
-
* GitHub master: <http://rubydoc.info/github/slim-template/slim/master/frames>
|
36
|
+
* 最新の Gem: <http://rubydoc.info/gems/slim/frames> <https://www.omniref.com/ruby/gems/slim>
|
37
|
+
* GitHub master: <http://rubydoc.info/github/slim-template/slim/master/frames> <https://www.omniref.com/github/slim-template/slim>
|
38
38
|
|
39
39
|
## イントロダクション
|
40
40
|
|
data/README.md
CHANGED
@@ -33,8 +33,8 @@ A short list of the features...
|
|
33
33
|
* Bugs: <http://github.com/slim-template/slim/issues>
|
34
34
|
* List: <http://groups.google.com/group/slim-template>
|
35
35
|
* API documentation:
|
36
|
-
* Latest Gem: <http://rubydoc.info/gems/slim/frames>
|
37
|
-
* GitHub master: <http://rubydoc.info/github/slim-template/slim/master/frames>
|
36
|
+
* Latest Gem: <http://rubydoc.info/gems/slim/frames> <https://www.omniref.com/ruby/gems/slim>
|
37
|
+
* GitHub master: <http://rubydoc.info/github/slim-template/slim/master/frames> <https://www.omniref.com/github/slim-template/slim>
|
38
38
|
|
39
39
|
## Introduction
|
40
40
|
|
data/lib/slim/splat/builder.rb
CHANGED
@@ -36,11 +36,30 @@ module Slim
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
def build_tag
|
39
|
+
def build_tag(&block)
|
40
40
|
tag = @attrs.delete('tag').to_s
|
41
41
|
tag = @options[:default_tag] if tag.empty?
|
42
|
-
if
|
43
|
-
|
42
|
+
if block
|
43
|
+
# This is a bit of a hack to get a universal capturing.
|
44
|
+
#
|
45
|
+
# TODO: Add this as a helper somewhere to solve these capturing issues
|
46
|
+
# once and for all.
|
47
|
+
#
|
48
|
+
# If we have Slim capturing disabled and the scope defines the method `capture` (i.e. Rails)
|
49
|
+
# we use this method to capture the content.
|
50
|
+
#
|
51
|
+
# otherwise we just use normal Slim capturing (yield).
|
52
|
+
#
|
53
|
+
# See https://github.com/slim-template/slim/issues/591
|
54
|
+
# https://github.com/slim-template/slim#helpers-capturing-and-includes
|
55
|
+
#
|
56
|
+
content =
|
57
|
+
if @options[:disable_capture] && (scope = block.binding.eval('self')).respond_to?(:capture)
|
58
|
+
scope.capture(&block)
|
59
|
+
else
|
60
|
+
yield
|
61
|
+
end
|
62
|
+
"<#{tag}#{build_attrs}>#{content}</#{tag}>"
|
44
63
|
else
|
45
64
|
"<#{tag}#{build_attrs} />"
|
46
65
|
end
|
data/lib/slim/splat/filter.rb
CHANGED
@@ -2,7 +2,7 @@ module Slim
|
|
2
2
|
module Splat
|
3
3
|
# @api private
|
4
4
|
class Filter < ::Slim::Filter
|
5
|
-
define_options :merge_attrs, :attr_quote, :sort_attrs, :default_tag, :format,
|
5
|
+
define_options :merge_attrs, :attr_quote, :sort_attrs, :default_tag, :format, :disable_capture,
|
6
6
|
hyphen_attrs: %w(data aria), use_html_safe: ''.respond_to?(:html_safe?)
|
7
7
|
|
8
8
|
def call(exp)
|
data/lib/slim/version.rb
CHANGED
@@ -82,4 +82,9 @@ class TestSlim < ActionDispatch::IntegrationTest
|
|
82
82
|
assert_match %r{<label><b>Name</b></label>}, @response.body
|
83
83
|
assert_xpath '//input[@id="entry_name" and @name="entry[name]" and @type="text"]'
|
84
84
|
end
|
85
|
+
|
86
|
+
test "splat" do
|
87
|
+
get "/slim/splat"
|
88
|
+
assert_html "<div id=\"splat\"><splat>Hello</splat></div>"
|
89
|
+
end
|
85
90
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Mendler
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-03-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: temple
|
@@ -157,6 +157,7 @@ files:
|
|
157
157
|
- test/rails/app/views/slim/no_layout.html.slim
|
158
158
|
- test/rails/app/views/slim/normal.html.slim
|
159
159
|
- test/rails/app/views/slim/partial.html.slim
|
160
|
+
- test/rails/app/views/slim/splat.html.slim
|
160
161
|
- test/rails/app/views/slim/thread_options.html.slim
|
161
162
|
- test/rails/app/views/slim/variables.html.slim
|
162
163
|
- test/rails/app/views/slim/xml.slim
|