stasis 0.1.15 → 0.1.16
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/stasis/plugins/layout.rb +23 -4
- data/stasis.gemspec +1 -1
- metadata +3 -3
@@ -16,11 +16,30 @@ class Stasis
|
|
16
16
|
return unless @stasis.path
|
17
17
|
@stasis.action._layout = nil
|
18
18
|
matches = _match_key?(@layouts, @stasis.path)
|
19
|
-
#
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
# Non-HTML extensions.
|
20
|
+
non_html = %w(sass scss less builder coffee yajl)
|
21
|
+
# Find matching layout.
|
22
|
+
[ :same, :similar ].each do |type|
|
23
|
+
matches.each do |(within, layout, non_specific)|
|
24
|
+
layout_ext = File.extname(layout)[1..-1]
|
25
|
+
path_ext = File.extname(@stasis.path)[1..-1]
|
26
|
+
|
27
|
+
match =
|
28
|
+
case type
|
29
|
+
# Same extension?
|
30
|
+
when :same then
|
31
|
+
layout_ext == path_ext
|
32
|
+
# Similar extension?
|
33
|
+
when :similar then
|
34
|
+
non_html.include?(layout_ext) == non_html.include?(path_ext)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Set layout
|
38
|
+
if _within?(within) && match
|
39
|
+
@stasis.action._layout = layout
|
40
|
+
end
|
23
41
|
end
|
42
|
+
break if @stasis.action._layout
|
24
43
|
end
|
25
44
|
# If layout not found, try again without extension requirement for specific layout
|
26
45
|
# definitions only.
|
data/stasis.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stasis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 59
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 16
|
10
|
+
version: 0.1.16
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Winton Welsh
|