sutty-liquid 0.11.5 → 0.11.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll/filters/arrays.rb +2 -2
- data/lib/jekyll/filters/yaml_to_scss.rb +4 -39
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8146d61e2bbdc0a8f4b412c3f24547c7bfdcfc5b2192f394e2cfec5397790a4
|
4
|
+
data.tar.gz: 063f2a57bbfa8c45259c0231ef0b749de028c0c25fd072a0e4b8bf8e79eab298
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1ee5f7cd5145b11572b1c934ff153d6cd34a9d4d54b75d2ed5838dc75192f059a51eb46cff9129b3aa3a5c248b1f50c1f4ef8883d60fdf8290b4e29b9daa2a3
|
7
|
+
data.tar.gz: 97b5f481d4c23e69acc51dd02e7e4110fff2feef56cbabf9a799533f720be55e31b0f80716edfedff208fa59cd227c5bbedd7d3013c3454cc0002dd767f066e4
|
@@ -22,11 +22,11 @@ module Jekyll
|
|
22
22
|
# @example
|
23
23
|
# {% assign things = site.posts | where: "layout", "thing" %}
|
24
24
|
# {% assign being = site.posts | find: "layout", "being" %}
|
25
|
-
# {% assign dread = things |
|
25
|
+
# {% assign dread = things | concat_or_append: being %}
|
26
26
|
#
|
27
27
|
# @param input [Array]
|
28
28
|
# @param concatenable [Array,any]
|
29
|
-
def
|
29
|
+
def concat_or_append(input, concatenable)
|
30
30
|
input = [] unless array? input
|
31
31
|
|
32
32
|
if concatenable.is_a? Array
|
@@ -4,11 +4,6 @@ module Jekyll
|
|
4
4
|
module Filters
|
5
5
|
# YAML to SCSS
|
6
6
|
module YamlToScss
|
7
|
-
# @see {https://sass-lang.com/documentation/values/strings#unquoted}
|
8
|
-
CSS_IDENTIFIER_SHORT = /\A-?\w+\z/
|
9
|
-
CSS_IDENTIFIER_LONG = /\A--[\w0-9]+\z/
|
10
|
-
SCSS_FUNCTION = /\A[0-9a-z]+\(/
|
11
|
-
|
12
7
|
# Converts a YAML object into SCSS. Only supports one level
|
13
8
|
# values.
|
14
9
|
#
|
@@ -29,12 +24,13 @@ module Jekyll
|
|
29
24
|
yaml.slice(*schema.keys).map do |key, value|
|
30
25
|
next if value.nil?
|
31
26
|
|
27
|
+
escape = schema[key].is_a?(Hash) && %w[image file].include?(schema.dig(key, 'type'))
|
32
28
|
key = key_to_scss key
|
33
29
|
|
34
30
|
case value
|
35
31
|
when Array
|
36
32
|
values = value.compact.map(&:to_s).reject(&:empty?).map do |v|
|
37
|
-
|
33
|
+
escape ? v.dump : v
|
38
34
|
end
|
39
35
|
|
40
36
|
"$#{key}: (#{values.join(',')},);"
|
@@ -44,7 +40,7 @@ module Jekyll
|
|
44
40
|
next if v.nil?
|
45
41
|
next if v.to_s.empty?
|
46
42
|
|
47
|
-
v = v.dump
|
43
|
+
v = v.dump if escape
|
48
44
|
|
49
45
|
"\"#{key_to_scss k}\": #{v}"
|
50
46
|
end
|
@@ -52,7 +48,7 @@ module Jekyll
|
|
52
48
|
"$#{key}: (#{values.join(',')},);"
|
53
49
|
else
|
54
50
|
next if value.to_s.empty?
|
55
|
-
value = value.dump
|
51
|
+
value = value.dump if escape
|
56
52
|
|
57
53
|
"$#{key}: #{value};"
|
58
54
|
end
|
@@ -68,37 +64,6 @@ module Jekyll
|
|
68
64
|
def key_to_scss(key)
|
69
65
|
key.to_s.tr '_', '-'
|
70
66
|
end
|
71
|
-
|
72
|
-
# Detects if value is a SCSS/SASS expression
|
73
|
-
#
|
74
|
-
# @param :value [Any]
|
75
|
-
# @return [Bool]
|
76
|
-
def scss_expression?(value)
|
77
|
-
return true unless value.is_a? String
|
78
|
-
# Quoted?
|
79
|
-
return false if value.start_with? '"'
|
80
|
-
return false if value.start_with? '\''
|
81
|
-
# Array/hash?
|
82
|
-
return true if value.start_with? '('
|
83
|
-
# Variable?
|
84
|
-
return true if value.start_with? '$'
|
85
|
-
# RGB color?
|
86
|
-
return true if value.start_with? '#'
|
87
|
-
# Negative number or CSS identifier?
|
88
|
-
return true if value.start_with? '-'
|
89
|
-
|
90
|
-
# Number?
|
91
|
-
(0..9).each do |i|
|
92
|
-
return true if value.start_with? i.to_s
|
93
|
-
end
|
94
|
-
|
95
|
-
# CSS identifier?
|
96
|
-
return true if CSS_IDENTIFIER_SHORT =~ value
|
97
|
-
return true if CSS_IDENTIFIER_LONG =~ value
|
98
|
-
return true if SCSS_FUNCTION =~ value
|
99
|
-
|
100
|
-
false
|
101
|
-
end
|
102
67
|
end
|
103
68
|
end
|
104
69
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sutty-liquid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- f
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fast_blank
|
@@ -180,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
180
|
- !ruby/object:Gem::Version
|
181
181
|
version: '0'
|
182
182
|
requirements: []
|
183
|
-
rubygems_version: 3.
|
183
|
+
rubygems_version: 3.3.26
|
184
184
|
signing_key:
|
185
185
|
specification_version: 4
|
186
186
|
summary: Liquid filters
|