sutty-liquid 0.10.0 → 0.11.0
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 +4 -4
- data/lib/jekyll/filters/assertion.rb +1 -1
- data/lib/jekyll/filters/content.rb +3 -3
- data/lib/jekyll/filters/date_local.rb +1 -1
- data/lib/jekyll/filters/menu.rb +2 -2
- data/lib/jekyll/filters/number.rb +1 -1
- data/lib/jekyll/filters/strings.rb +6 -6
- data/lib/jekyll/filters/yaml_to_scss.rb +45 -0
- metadata +32 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a57d48060de63b47e4d6f1f8dc2ad27f733ee725b7a55bf4d97a77f6be1db94
|
4
|
+
data.tar.gz: dc74a6339cd2069f9f1ea796de1ee6965cc6955b19be601ad0b1d1da2187feea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c64593338e53641d348e365496b7d800e34d987a16076e1829f25d76874fe7883c7ef3171839b0c4c424882ce5e5ee28fe425012775510d4f4c6173e6639b0a
|
7
|
+
data.tar.gz: df1e86422ae685a43619b0586a2bf654b9b6697fddec9b8ce9c9c12d3d7b0a209c3c7bc27ea305156bfe489a53af3d22884bb74ef4ba3bf9838c8d61ae622757
|
@@ -103,10 +103,10 @@ module Jekyll
|
|
103
103
|
liquid_input = input.to_liquid
|
104
104
|
liquid_posts = posts.map(&:to_liquid)
|
105
105
|
index = find_in_stack(liquid_input, liquid_posts)
|
106
|
-
liquid_posts[index - 1] if index
|
106
|
+
liquid_posts[index - 1] if index&.positive?
|
107
107
|
end
|
108
108
|
|
109
|
-
|
109
|
+
alias previous prev
|
110
110
|
|
111
111
|
private
|
112
112
|
|
@@ -120,7 +120,7 @@ module Jekyll
|
|
120
120
|
next if a
|
121
121
|
next unless @context.strict_filters
|
122
122
|
|
123
|
-
raise Liquid::ArgumentError
|
123
|
+
raise Liquid::ArgumentError, 'needs an array argument'
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
@@ -139,7 +139,7 @@ module Jekyll
|
|
139
139
|
p['title'] || p['id'] || 'no title'
|
140
140
|
end
|
141
141
|
|
142
|
-
raise Liquid::ArgumentError
|
142
|
+
raise Liquid::ArgumentError, "can't find #{title} in #{titles.join(', ')}"
|
143
143
|
end
|
144
144
|
end
|
145
145
|
end
|
@@ -36,7 +36,7 @@ module Jekyll
|
|
36
36
|
toc[id] = {
|
37
37
|
'level' => h.name[1].to_i,
|
38
38
|
'title' => h.text,
|
39
|
-
'id'
|
39
|
+
'id' => id
|
40
40
|
}
|
41
41
|
end
|
42
42
|
end.to_s
|
@@ -50,7 +50,7 @@ module Jekyll
|
|
50
50
|
#
|
51
51
|
# @example Create a table of contents
|
52
52
|
# {% assign toc = content | table_of_contents: 2 %}
|
53
|
-
#
|
53
|
+
#
|
54
54
|
# {% unless toc == empty %}
|
55
55
|
# {% for item in toc %}
|
56
56
|
# {% assign heading = "h" | append: item.level %}
|
@@ -68,7 +68,7 @@ module Jekyll
|
|
68
68
|
def table_of_contents(input, max_level = 2, prefix = nil)
|
69
69
|
canonicalize_headings(input, prefix)
|
70
70
|
|
71
|
-
toc(input).select do |
|
71
|
+
toc(input).select do |_id, item|
|
72
72
|
item['level'] <= max_level
|
73
73
|
end.values
|
74
74
|
end
|
data/lib/jekyll/filters/menu.rb
CHANGED
@@ -20,7 +20,7 @@ module Jekyll
|
|
20
20
|
# @param [String] The URL to be verified
|
21
21
|
# @return [String] The item URL
|
22
22
|
def menu_active_item(page_url)
|
23
|
-
site_menu&.find do |key,
|
23
|
+
site_menu&.find do |key, _value|
|
24
24
|
key == page_url || page_url.start_with?(key)
|
25
25
|
end&.last
|
26
26
|
end
|
@@ -47,7 +47,7 @@ module Jekyll
|
|
47
47
|
end
|
48
48
|
|
49
49
|
# Ignore empty or anchor items
|
50
|
-
next menu if item['href'].nil? || item['href']
|
50
|
+
next menu if item['href'].nil? || item['href']&.empty? || item['href']&.start_with?('#')
|
51
51
|
|
52
52
|
menu[item['href']] = item['href']
|
53
53
|
|
@@ -54,12 +54,12 @@ module Jekyll
|
|
54
54
|
#
|
55
55
|
# 5. Recover original stars
|
56
56
|
input.to_s
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
57
|
+
.gsub('\*', escaped_delimiter)
|
58
|
+
.gsub('**', star_delimiter * 2)
|
59
|
+
.gsub(/^(\s*)\*/, "\\1#{star_delimiter}")
|
60
|
+
.gsub('*', '\*')
|
61
|
+
.gsub(star_delimiter, '*')
|
62
|
+
.gsub(escaped_delimiter, '\*')
|
63
63
|
end
|
64
64
|
|
65
65
|
def unescape(input)
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
module Filters
|
5
|
+
# YAML to SCSS
|
6
|
+
module YamlToScss
|
7
|
+
# Converts a YAML object into SCSS. Only supports one level
|
8
|
+
# values.
|
9
|
+
#
|
10
|
+
# @param :yaml [Hash]
|
11
|
+
# @return [String]
|
12
|
+
def yaml_to_scss(yaml)
|
13
|
+
yaml.map do |key, value|
|
14
|
+
key = key_to_scss key
|
15
|
+
|
16
|
+
case value
|
17
|
+
when Array
|
18
|
+
"$#{key}: (#{value.join(',')},);"
|
19
|
+
when Hash
|
20
|
+
values =
|
21
|
+
value.map do |k, v|
|
22
|
+
"\"#{key_to_scss k}\": #{v}"
|
23
|
+
end
|
24
|
+
|
25
|
+
"$#{key}: (#{values.join(',')},);"
|
26
|
+
else
|
27
|
+
"$#{key}: #{value};"
|
28
|
+
end
|
29
|
+
end.join("\n")
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
# Dasherize key
|
35
|
+
#
|
36
|
+
# @param :key [String]
|
37
|
+
# @return [String]
|
38
|
+
def key_to_scss(key)
|
39
|
+
key.tr '_', '-'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
Liquid::Template.register_filter(Jekyll::Filters::YamlToScss)
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sutty-liquid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- f
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: fast_blank
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: jekyll
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '4'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '4'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,19 +53,19 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '5.14'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: nokogiri
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: pry
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,7 +81,21 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0.13'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '13'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '13'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - ">="
|
@@ -132,6 +146,7 @@ files:
|
|
132
146
|
- lib/jekyll/filters/pry.rb
|
133
147
|
- lib/jekyll/filters/social_network.rb
|
134
148
|
- lib/jekyll/filters/strings.rb
|
149
|
+
- lib/jekyll/filters/yaml_to_scss.rb
|
135
150
|
- lib/jekyll/tags/pry.rb
|
136
151
|
- lib/sutty-liquid.rb
|
137
152
|
homepage: https://0xacab.org/sutty/jekyll/sutty-liquid
|
@@ -156,16 +171,16 @@ require_paths:
|
|
156
171
|
- lib
|
157
172
|
required_ruby_version: !ruby/object:Gem::Requirement
|
158
173
|
requirements:
|
159
|
-
- - "
|
174
|
+
- - ">"
|
160
175
|
- !ruby/object:Gem::Version
|
161
|
-
version: 2.
|
176
|
+
version: 2.7.0
|
162
177
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
178
|
requirements:
|
164
179
|
- - ">="
|
165
180
|
- !ruby/object:Gem::Version
|
166
181
|
version: '0'
|
167
182
|
requirements: []
|
168
|
-
rubygems_version: 3.3.
|
183
|
+
rubygems_version: 3.3.19
|
169
184
|
signing_key:
|
170
185
|
specification_version: 4
|
171
186
|
summary: Liquid filters
|