sutty-liquid 0.11.5 → 0.11.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fbea4639befe5fa090125f1f820f2d54128daef26382ce37ca87eb0260c9b559
4
- data.tar.gz: 17fdf076023eaa6f0af383f779f3d42e470b92b41cc28f66f35688751fd2b62b
3
+ metadata.gz: a9bcc5adc518ebd74470acbf0b797a629482d627ae4e5b99f4aeb4115ea97059
4
+ data.tar.gz: f5b9de8760bbb070bff3b6e2f43dfa26f5a2c350e843cb0fede9a6d6b948708e
5
5
  SHA512:
6
- metadata.gz: cf5d40db995baf63acc1ef8dac83c75d4aab6ed57f0cdf62f98c0e0c1f47bcd61a17a8c82396134db458071452d7b396a0b1300e64556f82741e6ba7b1969b65
7
- data.tar.gz: 1aebbb6f79d474c1932c927d9c856807c14ba3438ed796929f80f9f12cfd86ce22464a561a46579cc761185edf95bd9bc234f703a17a4c3a934b6db42a975d14
6
+ metadata.gz: e88928c41e676ffef64066404b7db2fa90060dfb8bd0c8670c75fa85997b4bd4f2cb35f8a5b8427da5eeba131d11008fb8c44480b79ba5b567f2c448268ee953
7
+ data.tar.gz: 5842a7edc7fcb414f41616cedde4627be828d24d9ecaf4175a45a0b818c17e9d41d896580e7c33305316459b7e559da05a8cf1df6bdc375ed242ce1ba44422a3
@@ -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
- scss_expression?(v) ? v : v.dump
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 unless scss_expression? v
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 unless scss_expression? value
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sutty-liquid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.5
4
+ version: 0.11.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - f