jekyll-gallery-plugin 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -2
- data/Gemfile.lock +150 -55
- data/jekyll-gallery-plugin.gemspec +1 -1
- data/lib/jekyll/gallery/config.rb +2 -1
- data/lib/jekyll/gallery/helper.rb +5 -21
- data/lib/jekyll/gallery/seo.rb +4 -2
- data/lib/jekyll/gallery/tags.rb +49 -21
- data/lib/jekyll/gallery/templates.rb +26 -0
- data/lib/jekyll/gallery/utils.rb +5 -5
- data/lib/jekyll/gallery/version.rb +1 -1
- data/lib/jekyll/gallery.rb +1 -0
- data/lib/jekyll-gallery-default.html +21 -0
- metadata +6 -9
- data/lib/jekyll-gallery-gallery.html +0 -3
- data/lib/jekyll-gallery-image.html +0 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d866efaabe44af6848275bd7d9aa4241f70f5b28b6f1f24cb4633fd8463ee1d0
|
|
4
|
+
data.tar.gz: 24afc76e89fc2509eea1863e8bc0d1888cdf0961bdb48d69bc87be973362ab55
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5ee6ae9ec2298ebe4413d6750388bafbf38d9ad0c86cead74f46ae87b568d2a0558b5d01e824b70e76ac5a7ba58a4941d6977660b7047a29b2b56840a99c15e6
|
|
7
|
+
data.tar.gz: 668fdb6c3503977b9181ba13c6f20993aa42cc7ea5c31722c4fa40d4e9933c6bec6e0102bacc7024b60ce62b865b0475c6eb6e82da1b3b6dec3a9bebd42c0f2f
|
data/.rubocop.yml
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
AllCops:
|
|
2
|
-
TargetRubyVersion:
|
|
2
|
+
TargetRubyVersion: 3.4
|
|
3
3
|
NewCops: enable
|
|
4
4
|
SuggestExtensions: false
|
|
5
|
+
Exclude:
|
|
6
|
+
- "**/_OLD/*"
|
|
5
7
|
|
|
6
8
|
Style/StringLiterals:
|
|
7
9
|
Enabled: true
|
|
@@ -33,4 +35,3 @@ Metrics/CyclomaticComplexity:
|
|
|
33
35
|
Metrics/PerceivedComplexity:
|
|
34
36
|
Exclude:
|
|
35
37
|
- '**/tags.rb'
|
|
36
|
-
|
data/Gemfile.lock
CHANGED
|
@@ -1,111 +1,206 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
jekyll-gallery-plugin (1.
|
|
4
|
+
jekyll-gallery-plugin (1.1.0)
|
|
5
5
|
jekyll (>= 3.7, < 5.0)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
addressable (2.
|
|
11
|
-
public_suffix (>= 2.0.2, <
|
|
12
|
-
ast (2.4.
|
|
10
|
+
addressable (2.9.0)
|
|
11
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
12
|
+
ast (2.4.3)
|
|
13
|
+
base64 (0.3.0)
|
|
14
|
+
bigdecimal (4.1.3)
|
|
13
15
|
colorator (1.1.0)
|
|
14
|
-
concurrent-ruby (1.
|
|
15
|
-
|
|
16
|
+
concurrent-ruby (1.3.8)
|
|
17
|
+
csv (3.3.6)
|
|
18
|
+
diff-lcs (1.6.2)
|
|
16
19
|
em-websocket (0.5.3)
|
|
17
20
|
eventmachine (>= 0.12.9)
|
|
18
21
|
http_parser.rb (~> 0)
|
|
19
22
|
eventmachine (1.2.7)
|
|
20
|
-
ffi (1.
|
|
23
|
+
ffi (1.17.4)
|
|
24
|
+
ffi (1.17.4-aarch64-linux-gnu)
|
|
25
|
+
ffi (1.17.4-aarch64-linux-musl)
|
|
26
|
+
ffi (1.17.4-arm-linux-gnu)
|
|
27
|
+
ffi (1.17.4-arm-linux-musl)
|
|
28
|
+
ffi (1.17.4-arm64-darwin)
|
|
29
|
+
ffi (1.17.4-x86-linux-gnu)
|
|
30
|
+
ffi (1.17.4-x86-linux-musl)
|
|
31
|
+
ffi (1.17.4-x86_64-darwin)
|
|
32
|
+
ffi (1.17.4-x86_64-linux-gnu)
|
|
33
|
+
ffi (1.17.4-x86_64-linux-musl)
|
|
21
34
|
forwardable-extended (2.6.0)
|
|
22
|
-
google-protobuf (
|
|
23
|
-
|
|
24
|
-
|
|
35
|
+
google-protobuf (4.36.2)
|
|
36
|
+
bigdecimal
|
|
37
|
+
rake (~> 13.3)
|
|
38
|
+
google-protobuf (4.36.2-aarch64-linux-gnu)
|
|
39
|
+
bigdecimal
|
|
40
|
+
rake (~> 13.3)
|
|
41
|
+
google-protobuf (4.36.2-aarch64-linux-musl)
|
|
42
|
+
bigdecimal
|
|
43
|
+
rake (~> 13.3)
|
|
44
|
+
google-protobuf (4.36.2-arm64-darwin)
|
|
45
|
+
bigdecimal
|
|
46
|
+
rake (~> 13.3)
|
|
47
|
+
google-protobuf (4.36.2-x86-linux-gnu)
|
|
48
|
+
bigdecimal
|
|
49
|
+
rake (~> 13.3)
|
|
50
|
+
google-protobuf (4.36.2-x86-linux-musl)
|
|
51
|
+
bigdecimal
|
|
52
|
+
rake (~> 13.3)
|
|
53
|
+
google-protobuf (4.36.2-x86_64-darwin)
|
|
54
|
+
bigdecimal
|
|
55
|
+
rake (~> 13.3)
|
|
56
|
+
google-protobuf (4.36.2-x86_64-linux-gnu)
|
|
57
|
+
bigdecimal
|
|
58
|
+
rake (~> 13.3)
|
|
59
|
+
google-protobuf (4.36.2-x86_64-linux-musl)
|
|
60
|
+
bigdecimal
|
|
61
|
+
rake (~> 13.3)
|
|
62
|
+
http_parser.rb (0.8.1)
|
|
63
|
+
i18n (1.15.2)
|
|
25
64
|
concurrent-ruby (~> 1.0)
|
|
26
|
-
jekyll (4.
|
|
65
|
+
jekyll (4.4.1)
|
|
27
66
|
addressable (~> 2.4)
|
|
67
|
+
base64 (~> 0.2)
|
|
28
68
|
colorator (~> 1.0)
|
|
69
|
+
csv (~> 3.0)
|
|
29
70
|
em-websocket (~> 0.5)
|
|
30
71
|
i18n (~> 1.0)
|
|
31
72
|
jekyll-sass-converter (>= 2.0, < 4.0)
|
|
32
73
|
jekyll-watch (~> 2.0)
|
|
74
|
+
json (~> 2.6)
|
|
33
75
|
kramdown (~> 2.3, >= 2.3.1)
|
|
34
76
|
kramdown-parser-gfm (~> 1.0)
|
|
35
77
|
liquid (~> 4.0)
|
|
36
|
-
mercenary (
|
|
78
|
+
mercenary (~> 0.3, >= 0.3.6)
|
|
37
79
|
pathutil (~> 0.9)
|
|
38
80
|
rouge (>= 3.0, < 5.0)
|
|
39
81
|
safe_yaml (~> 1.0)
|
|
40
82
|
terminal-table (>= 1.8, < 4.0)
|
|
41
83
|
webrick (~> 1.7)
|
|
42
|
-
jekyll-sass-converter (3.
|
|
43
|
-
sass-embedded (~> 1.
|
|
84
|
+
jekyll-sass-converter (3.1.0)
|
|
85
|
+
sass-embedded (~> 1.75)
|
|
44
86
|
jekyll-watch (2.2.1)
|
|
45
87
|
listen (~> 3.0)
|
|
46
|
-
json (2.
|
|
47
|
-
kramdown (2.
|
|
48
|
-
rexml
|
|
88
|
+
json (2.21.2)
|
|
89
|
+
kramdown (2.5.2)
|
|
90
|
+
rexml (>= 3.4.4)
|
|
49
91
|
kramdown-parser-gfm (1.1.0)
|
|
50
92
|
kramdown (~> 2.0)
|
|
93
|
+
language_server-protocol (3.17.0.6)
|
|
94
|
+
lint_roller (1.1.0)
|
|
51
95
|
liquid (4.0.4)
|
|
52
|
-
listen (3.
|
|
96
|
+
listen (3.10.0)
|
|
97
|
+
logger
|
|
53
98
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
54
99
|
rb-inotify (~> 0.9, >= 0.9.10)
|
|
100
|
+
logger (1.7.0)
|
|
55
101
|
mercenary (0.4.0)
|
|
56
|
-
parallel (
|
|
57
|
-
parser (3.
|
|
102
|
+
parallel (2.2.0)
|
|
103
|
+
parser (3.3.12.0)
|
|
58
104
|
ast (~> 2.4.1)
|
|
59
105
|
racc
|
|
60
106
|
pathutil (0.16.2)
|
|
61
107
|
forwardable-extended (~> 2.6)
|
|
62
|
-
|
|
63
|
-
|
|
108
|
+
prism (1.9.0)
|
|
109
|
+
public_suffix (7.0.5)
|
|
110
|
+
racc (1.8.1)
|
|
64
111
|
rainbow (3.1.1)
|
|
65
|
-
rake (13.
|
|
112
|
+
rake (13.4.2)
|
|
66
113
|
rb-fsevent (0.11.2)
|
|
67
|
-
rb-inotify (0.
|
|
114
|
+
rb-inotify (0.11.1)
|
|
68
115
|
ffi (~> 1.0)
|
|
69
|
-
regexp_parser (2.
|
|
70
|
-
rexml (3.
|
|
71
|
-
rouge (
|
|
72
|
-
rspec (3.
|
|
73
|
-
rspec-core (~> 3.
|
|
74
|
-
rspec-expectations (~> 3.
|
|
75
|
-
rspec-mocks (~> 3.
|
|
76
|
-
rspec-core (3.
|
|
77
|
-
rspec-support (~> 3.
|
|
78
|
-
rspec-expectations (3.
|
|
116
|
+
regexp_parser (2.13.0)
|
|
117
|
+
rexml (3.4.4)
|
|
118
|
+
rouge (4.7.0)
|
|
119
|
+
rspec (3.13.2)
|
|
120
|
+
rspec-core (~> 3.13.0)
|
|
121
|
+
rspec-expectations (~> 3.13.0)
|
|
122
|
+
rspec-mocks (~> 3.13.0)
|
|
123
|
+
rspec-core (3.13.6)
|
|
124
|
+
rspec-support (~> 3.13.0)
|
|
125
|
+
rspec-expectations (3.13.5)
|
|
79
126
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
80
|
-
rspec-support (~> 3.
|
|
81
|
-
rspec-mocks (3.
|
|
127
|
+
rspec-support (~> 3.13.0)
|
|
128
|
+
rspec-mocks (3.13.8)
|
|
82
129
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
83
|
-
rspec-support (~> 3.
|
|
84
|
-
rspec-support (3.
|
|
85
|
-
rubocop (1.
|
|
86
|
-
json (
|
|
87
|
-
|
|
88
|
-
|
|
130
|
+
rspec-support (~> 3.13.0)
|
|
131
|
+
rspec-support (3.13.7)
|
|
132
|
+
rubocop (1.91.0)
|
|
133
|
+
json (>= 2.3)
|
|
134
|
+
language_server-protocol (~> 3.17.0.2)
|
|
135
|
+
lint_roller (~> 1.1.0)
|
|
136
|
+
parallel (>= 1.10)
|
|
137
|
+
parser (>= 3.3.0.2)
|
|
89
138
|
rainbow (>= 2.2.2, < 4.0)
|
|
90
|
-
regexp_parser (>=
|
|
91
|
-
|
|
92
|
-
rubocop-ast (>= 1.28.0, < 2.0)
|
|
139
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
140
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
93
141
|
ruby-progressbar (~> 1.7)
|
|
94
|
-
unicode-display_width (>= 2.4.0, <
|
|
95
|
-
rubocop-ast (1.
|
|
96
|
-
parser (>= 3.
|
|
142
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
143
|
+
rubocop-ast (1.50.0)
|
|
144
|
+
parser (>= 3.3.7.2)
|
|
145
|
+
prism (~> 1.7)
|
|
97
146
|
ruby-progressbar (1.13.0)
|
|
98
147
|
safe_yaml (1.0.5)
|
|
99
|
-
sass-embedded (1.
|
|
100
|
-
google-protobuf (~>
|
|
101
|
-
rake (
|
|
148
|
+
sass-embedded (1.105.0)
|
|
149
|
+
google-protobuf (~> 4.31)
|
|
150
|
+
rake (~> 13.3)
|
|
151
|
+
sass-embedded (1.105.0-aarch64-linux-android)
|
|
152
|
+
google-protobuf (~> 4.31)
|
|
153
|
+
sass-embedded (1.105.0-aarch64-linux-gnu)
|
|
154
|
+
google-protobuf (~> 4.31)
|
|
155
|
+
sass-embedded (1.105.0-aarch64-linux-musl)
|
|
156
|
+
google-protobuf (~> 4.31)
|
|
157
|
+
sass-embedded (1.105.0-arm-linux-androideabi)
|
|
158
|
+
google-protobuf (~> 4.31)
|
|
159
|
+
sass-embedded (1.105.0-arm-linux-gnueabihf)
|
|
160
|
+
google-protobuf (~> 4.31)
|
|
161
|
+
sass-embedded (1.105.0-arm-linux-musleabihf)
|
|
162
|
+
google-protobuf (~> 4.31)
|
|
163
|
+
sass-embedded (1.105.0-arm64-darwin)
|
|
164
|
+
google-protobuf (~> 4.31)
|
|
165
|
+
sass-embedded (1.105.0-riscv64-linux-android)
|
|
166
|
+
google-protobuf (~> 4.31)
|
|
167
|
+
sass-embedded (1.105.0-riscv64-linux-gnu)
|
|
168
|
+
google-protobuf (~> 4.31)
|
|
169
|
+
sass-embedded (1.105.0-riscv64-linux-musl)
|
|
170
|
+
google-protobuf (~> 4.31)
|
|
171
|
+
sass-embedded (1.105.0-x86_64-darwin)
|
|
172
|
+
google-protobuf (~> 4.31)
|
|
173
|
+
sass-embedded (1.105.0-x86_64-linux-android)
|
|
174
|
+
google-protobuf (~> 4.31)
|
|
175
|
+
sass-embedded (1.105.0-x86_64-linux-gnu)
|
|
176
|
+
google-protobuf (~> 4.31)
|
|
177
|
+
sass-embedded (1.105.0-x86_64-linux-musl)
|
|
178
|
+
google-protobuf (~> 4.31)
|
|
102
179
|
terminal-table (3.0.2)
|
|
103
180
|
unicode-display_width (>= 1.1.1, < 3)
|
|
104
|
-
unicode-display_width (2.
|
|
105
|
-
webrick (1.
|
|
181
|
+
unicode-display_width (2.6.0)
|
|
182
|
+
webrick (1.9.2)
|
|
106
183
|
|
|
107
184
|
PLATFORMS
|
|
108
|
-
|
|
185
|
+
aarch64-linux-android
|
|
186
|
+
aarch64-linux-gnu
|
|
187
|
+
aarch64-linux-musl
|
|
188
|
+
arm-linux-androideabi
|
|
189
|
+
arm-linux-gnu
|
|
190
|
+
arm-linux-gnueabihf
|
|
191
|
+
arm-linux-musl
|
|
192
|
+
arm-linux-musleabihf
|
|
193
|
+
arm64-darwin
|
|
194
|
+
riscv64-linux-android
|
|
195
|
+
riscv64-linux-gnu
|
|
196
|
+
riscv64-linux-musl
|
|
197
|
+
ruby
|
|
198
|
+
x86-linux-gnu
|
|
199
|
+
x86-linux-musl
|
|
200
|
+
x86_64-darwin
|
|
201
|
+
x86_64-linux-android
|
|
202
|
+
x86_64-linux-gnu
|
|
203
|
+
x86_64-linux-musl
|
|
109
204
|
|
|
110
205
|
DEPENDENCIES
|
|
111
206
|
jekyll-gallery-plugin!
|
|
@@ -114,4 +209,4 @@ DEPENDENCIES
|
|
|
114
209
|
rubocop (~> 1.21)
|
|
115
210
|
|
|
116
211
|
BUNDLED WITH
|
|
117
|
-
2.
|
|
212
|
+
2.7.2
|
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
|
11
11
|
spec.summary = "Customizable Jekyll plugin that renders a gallery using the GLightbox Javascript library."
|
|
12
12
|
spec.description = "It applies a gallery template and checks for the files listed presence."
|
|
13
13
|
spec.homepage = "https://freeaptitude.altervista.org/projects/jekyll-gallery.html"
|
|
14
|
-
spec.required_ruby_version = ">=
|
|
14
|
+
spec.required_ruby_version = ">= 3.4.0"
|
|
15
15
|
|
|
16
16
|
# spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
|
|
17
17
|
|
|
@@ -7,6 +7,7 @@ module Jekyll
|
|
|
7
7
|
#
|
|
8
8
|
class Config
|
|
9
9
|
def self.gconfig
|
|
10
|
+
# This is equivalent to context.registers[:site].config
|
|
10
11
|
@@gconfig ||= Jekyll.configuration.freeze
|
|
11
12
|
end
|
|
12
13
|
|
|
@@ -23,7 +24,7 @@ module Jekyll
|
|
|
23
24
|
end
|
|
24
25
|
|
|
25
26
|
def self.config
|
|
26
|
-
@@config ||= gconfig["jekyll-gallery"].freeze
|
|
27
|
+
@@config ||= (gconfig["jekyll-gallery"] || {}).freeze
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
def self.selector
|
|
@@ -6,11 +6,11 @@ module Jekyll
|
|
|
6
6
|
# Contains the methods that assist the code creation.
|
|
7
7
|
#
|
|
8
8
|
module Helper
|
|
9
|
-
def
|
|
10
|
-
file = File.join(Dir.pwd,
|
|
9
|
+
def self.expand_template_file(name)
|
|
10
|
+
file = File.join(Dir.pwd, Config.gconfig["includes_dir"], "jekyll-gallery-#{name}.html")
|
|
11
11
|
return file if File.exist? file
|
|
12
12
|
|
|
13
|
-
File.expand_path(File.join(__dir__, "..", "..", "jekyll-gallery-#{
|
|
13
|
+
File.expand_path(File.join(__dir__, "..", "..", "jekyll-gallery-#{name}.html"))
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def self.collection_path(collection)
|
|
@@ -18,27 +18,11 @@ module Jekyll
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def self.expand_remote_file(file, collection)
|
|
21
|
-
|
|
22
|
-
a_path = Config.a_path
|
|
23
|
-
|
|
24
|
-
if file =~ /\|/
|
|
25
|
-
c, f = file.split("|")
|
|
26
|
-
return [base_path, a_path, collection_path(c), f].join("/")
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
[base_path, a_path, collection_path(collection), file].join("/")
|
|
21
|
+
[Config.base_url, Config.a_path, collection_path(collection), file].join("/")
|
|
30
22
|
end
|
|
31
23
|
|
|
32
24
|
def self.expand_local_file(file, collection)
|
|
33
|
-
|
|
34
|
-
source = Config.source
|
|
35
|
-
|
|
36
|
-
if file =~ /\|/
|
|
37
|
-
c, f = file.split("|")
|
|
38
|
-
return File.join(source, a_path, collection_path(c), f)
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
File.join(source, a_path, collection_path(collection), file)
|
|
25
|
+
File.join(Config.source, Config.a_path, collection_path(collection), file)
|
|
42
26
|
end
|
|
43
27
|
end
|
|
44
28
|
end
|
data/lib/jekyll/gallery/seo.rb
CHANGED
|
@@ -21,10 +21,12 @@ module Jekyll
|
|
|
21
21
|
return unless image.is_a? Hash
|
|
22
22
|
return if image["cover"].nil?
|
|
23
23
|
|
|
24
|
-
file = Helper.expand_local_file(image["cover"], collection)
|
|
24
|
+
file = Helper.expand_local_file(image["cover"], image["collection"] || collection)
|
|
25
25
|
raise MissingFile, file unless File.exist?(file)
|
|
26
26
|
|
|
27
|
-
image["path"] = Helper.expand_remote_file(image["cover"], collection)
|
|
27
|
+
image["path"] = Helper.expand_remote_file(image["cover"], image["collection"] || collection)
|
|
28
|
+
image.delete "collection"
|
|
29
|
+
image.delete "cover"
|
|
28
30
|
end
|
|
29
31
|
end
|
|
30
32
|
end
|
data/lib/jekyll/gallery/tags.rb
CHANGED
|
@@ -10,62 +10,90 @@ module Jekyll
|
|
|
10
10
|
|
|
11
11
|
def initialize(tag_name, text, tokens)
|
|
12
12
|
super
|
|
13
|
-
@@tpl_i ||= File.read(template("image", Config.gconfig)).freeze
|
|
14
|
-
@@tpl_g ||= File.read(template("gallery", Config.gconfig)).freeze
|
|
15
13
|
@text = text
|
|
16
14
|
end
|
|
17
15
|
|
|
18
16
|
def render(context)
|
|
19
17
|
init_params(@text, context)
|
|
18
|
+
|
|
20
19
|
site = context.registers[:site]
|
|
21
|
-
|
|
20
|
+
images = []
|
|
22
21
|
|
|
23
22
|
@files.each_with_index do |f, i|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
if f.key?("image") || f.key?("file")
|
|
24
|
+
image = expand_file(f["image"] || f["file"], f["collection"], i)
|
|
25
|
+
else
|
|
26
|
+
large_image = expand_file(f["large_image"], f["collection"], i)
|
|
27
|
+
small_image = expand_file(f["small_image"], f["collection"], i)
|
|
28
|
+
end
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
30
|
+
images << {
|
|
31
|
+
"image" => image,
|
|
32
|
+
"small_image" => small_image,
|
|
33
|
+
"large_image" => large_image,
|
|
34
|
+
"a_class" => f["a_class"] || @a_class,
|
|
35
|
+
"img_class" => f["img_class"] || @img_class,
|
|
36
|
+
"counter" => i.next,
|
|
34
37
|
"title" => f["title"],
|
|
35
38
|
"description" => f["description"],
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
+
"desc_position" => f["desc_position"] || @desc_position,
|
|
40
|
+
"type" => f["type"],
|
|
41
|
+
"effect" => f["effect"] || @effect,
|
|
42
|
+
"width" => f["width"] || @width,
|
|
43
|
+
"height" => f["height"] || @height,
|
|
44
|
+
"zoomable" => f["zoomable"] || @zoomable,
|
|
45
|
+
"draggable" => f["draggable"] || @draggable
|
|
39
46
|
}
|
|
40
|
-
tpl << (Liquid::Template.parse @@tpl_i).render(site.site_payload.merge!(vars))
|
|
41
47
|
end
|
|
42
48
|
|
|
43
|
-
images = tpl.join("\n")
|
|
44
49
|
vars = {
|
|
45
50
|
"images" => images,
|
|
51
|
+
"name" => @name,
|
|
46
52
|
"g_class" => @g_class
|
|
47
53
|
}
|
|
48
|
-
|
|
54
|
+
|
|
55
|
+
Templates.render(@tpl, site.site_payload.merge(vars))
|
|
49
56
|
end
|
|
50
57
|
|
|
51
58
|
private
|
|
52
59
|
|
|
53
60
|
def init_params(text, context)
|
|
54
61
|
params = text.split_params(context)
|
|
62
|
+
|
|
55
63
|
@name = params["name"]
|
|
56
64
|
raise MissingGallery if @name.nil? || @name.empty?
|
|
57
65
|
|
|
66
|
+
@tpl = params["template"] || "default"
|
|
67
|
+
|
|
58
68
|
@a_class = params["a_class"]
|
|
59
69
|
@img_class = params["img_class"]
|
|
60
|
-
@g_class = params["g_class"]
|
|
70
|
+
@g_class = params["g_class"]
|
|
71
|
+
@effect = params["effect"]
|
|
72
|
+
@width = params["width"]
|
|
73
|
+
@height = params["height"]
|
|
74
|
+
@zoomable = params["zoomable"]
|
|
75
|
+
@draggable = params["draggable"]
|
|
61
76
|
|
|
62
|
-
|
|
77
|
+
page = context.registers[:page]
|
|
78
|
+
# site = context.registers[:site]
|
|
79
|
+
|
|
80
|
+
@collection = context["#{Config.selector}.collection"] || page["collection"]
|
|
81
|
+
@collection = context["#{Config.selector}.layout"] || page["layout"] if @collection.nil?
|
|
63
82
|
|
|
64
83
|
@desc_position = params["desc_position"] || Config.config["desc_position"] || "bottom"
|
|
65
84
|
|
|
66
|
-
@files = context["#{Config.selector}.gallery.#{@name}"] ||
|
|
85
|
+
@files = context["#{Config.selector}.gallery.#{@name}"] || page["gallery"]&.dig(@name)
|
|
67
86
|
raise UnknownGallery, @name if @files.nil?
|
|
68
87
|
end
|
|
88
|
+
|
|
89
|
+
def expand_file(file, collection, index)
|
|
90
|
+
raise MissingFileField, { name: @name, idx: index.next } if file.nil?
|
|
91
|
+
|
|
92
|
+
lfile = Helper.expand_local_file(file, collection || @collection)
|
|
93
|
+
raise MissingFile, lfile unless File.exist?(lfile)
|
|
94
|
+
|
|
95
|
+
Helper.expand_remote_file(file, collection || @collection)
|
|
96
|
+
end
|
|
69
97
|
end
|
|
70
98
|
end
|
|
71
99
|
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "liquid"
|
|
4
|
+
|
|
5
|
+
module Jekyll
|
|
6
|
+
module Gallery
|
|
7
|
+
#
|
|
8
|
+
# Store rendered templates for
|
|
9
|
+
# a quicker access
|
|
10
|
+
#
|
|
11
|
+
class Templates
|
|
12
|
+
@@templates = {}
|
|
13
|
+
|
|
14
|
+
def self.template(name)
|
|
15
|
+
return @@templates[name] if @@templates.key? name
|
|
16
|
+
|
|
17
|
+
tpl = File.read(Helper.expand_template_file(name)).freeze
|
|
18
|
+
@@templates[name] = Liquid::Template.parse(tpl)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def self.render(name, vars)
|
|
22
|
+
template(name).render(vars)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
data/lib/jekyll/gallery/utils.rb
CHANGED
|
@@ -30,7 +30,7 @@ module Jekyll
|
|
|
30
30
|
#
|
|
31
31
|
class InvalidGroup < StandardError
|
|
32
32
|
def initialize(name)
|
|
33
|
-
super
|
|
33
|
+
super("The group '#{name}' is not valid!")
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
|
|
@@ -39,7 +39,7 @@ module Jekyll
|
|
|
39
39
|
#
|
|
40
40
|
class MissingGallery < StandardError
|
|
41
41
|
def initialize
|
|
42
|
-
super
|
|
42
|
+
super("No gallery name has been specified!")
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
|
|
@@ -48,7 +48,7 @@ module Jekyll
|
|
|
48
48
|
#
|
|
49
49
|
class UnknownGallery < StandardError
|
|
50
50
|
def initialize(name)
|
|
51
|
-
super
|
|
51
|
+
super("The gallery '#{name}' doesn't exist!")
|
|
52
52
|
end
|
|
53
53
|
end
|
|
54
54
|
|
|
@@ -57,7 +57,7 @@ module Jekyll
|
|
|
57
57
|
#
|
|
58
58
|
class MissingFile < StandardError
|
|
59
59
|
def initialize(name)
|
|
60
|
-
super
|
|
60
|
+
super("The file '#{name}' doesn't exist")
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
|
|
@@ -66,7 +66,7 @@ module Jekyll
|
|
|
66
66
|
#
|
|
67
67
|
class MissingFileField < StandardError
|
|
68
68
|
def initialize(data)
|
|
69
|
-
super
|
|
69
|
+
super("No 'file' field in the gallery '#{data[:name]}' item n.#{data[:idx]}!")
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
72
|
end
|
data/lib/jekyll/gallery.rb
CHANGED
|
@@ -7,6 +7,7 @@ require_relative "gallery/helper"
|
|
|
7
7
|
require_relative "gallery/tags"
|
|
8
8
|
require_relative "gallery/utils"
|
|
9
9
|
require_relative "gallery/seo"
|
|
10
|
+
require_relative "gallery/templates"
|
|
10
11
|
|
|
11
12
|
Liquid::Template.register_tag("gallery", Jekyll::Gallery::Gallery)
|
|
12
13
|
Jekyll::Gallery::SeoImage.setup
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<div class="gallery {{g_class}}">
|
|
2
|
+
{%- for i in images %}
|
|
3
|
+
<figure>
|
|
4
|
+
<a href="{{i.large_image | default: i.image}}"
|
|
5
|
+
class="glightbox{% if i.a_class %} {{i.a_class}}{% endif %}"
|
|
6
|
+
data-gallery="gallery-{{name}}"
|
|
7
|
+
data-type="{{i.type | default: "image"}}"
|
|
8
|
+
data-title="{{i.title}}"
|
|
9
|
+
data-description="{{i.description}}"
|
|
10
|
+
data-desc-position="{{i.desc_position}}"
|
|
11
|
+
data-effect="{{i.effect | default: "fade"}}"
|
|
12
|
+
data-width="{{i.width | default: "900px"}}"
|
|
13
|
+
data-height="{{i.height | default: "auto"}}"
|
|
14
|
+
data-zoomable="{{i.zoomable | default: "true"}}"
|
|
15
|
+
data-draggable="{{i.draggable | default: "true"}}">
|
|
16
|
+
<img src="{{i.small_image | default: i.image}}" alt="{{i.title}}" class="{{i.img_class}}">
|
|
17
|
+
</a>
|
|
18
|
+
<figcaption>{{i.title}}</figcaption>
|
|
19
|
+
</figure>
|
|
20
|
+
{%- endfor %}
|
|
21
|
+
</div>
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jekyll-gallery-plugin
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Fabio Mucciante
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: jekyll
|
|
@@ -46,14 +45,14 @@ files:
|
|
|
46
45
|
- README.md
|
|
47
46
|
- Rakefile
|
|
48
47
|
- jekyll-gallery-plugin.gemspec
|
|
49
|
-
- lib/jekyll-gallery-
|
|
50
|
-
- lib/jekyll-gallery-image.html
|
|
48
|
+
- lib/jekyll-gallery-default.html
|
|
51
49
|
- lib/jekyll-gallery-plugin.rb
|
|
52
50
|
- lib/jekyll/gallery.rb
|
|
53
51
|
- lib/jekyll/gallery/config.rb
|
|
54
52
|
- lib/jekyll/gallery/helper.rb
|
|
55
53
|
- lib/jekyll/gallery/seo.rb
|
|
56
54
|
- lib/jekyll/gallery/tags.rb
|
|
55
|
+
- lib/jekyll/gallery/templates.rb
|
|
57
56
|
- lib/jekyll/gallery/utils.rb
|
|
58
57
|
- lib/jekyll/gallery/version.rb
|
|
59
58
|
- sig/jekyll/gallery/plugin.rbs
|
|
@@ -65,7 +64,6 @@ metadata:
|
|
|
65
64
|
changelog_uri: https://freeaptitude.altervista.org/projects/jekyll-gallery.html#changelog
|
|
66
65
|
wiki_uri: https://github.com/fabiomux/jekyll-gallery-plugin/wiki
|
|
67
66
|
rubygems_mfa_required: 'true'
|
|
68
|
-
post_install_message:
|
|
69
67
|
rdoc_options: []
|
|
70
68
|
require_paths:
|
|
71
69
|
- lib
|
|
@@ -73,15 +71,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
73
71
|
requirements:
|
|
74
72
|
- - ">="
|
|
75
73
|
- !ruby/object:Gem::Version
|
|
76
|
-
version:
|
|
74
|
+
version: 3.4.0
|
|
77
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
76
|
requirements:
|
|
79
77
|
- - ">="
|
|
80
78
|
- !ruby/object:Gem::Version
|
|
81
79
|
version: '0'
|
|
82
80
|
requirements: []
|
|
83
|
-
rubygems_version: 3.
|
|
84
|
-
signing_key:
|
|
81
|
+
rubygems_version: 3.6.9
|
|
85
82
|
specification_version: 4
|
|
86
83
|
summary: Customizable Jekyll plugin that renders a gallery using the GLightbox Javascript
|
|
87
84
|
library.
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<figure>
|
|
2
|
-
<a href="{{filename}}"
|
|
3
|
-
class="glightbox {{a_class}}"
|
|
4
|
-
data-gallery="gallery-{{name}}"
|
|
5
|
-
data-type="image"
|
|
6
|
-
data-title="{{title}}"
|
|
7
|
-
data-description="{{description}}"
|
|
8
|
-
data-desc-position="{{desc_position}}">
|
|
9
|
-
<img src="{{filename}}" alt="{{title}}" class="{{img_class}}">
|
|
10
|
-
</a>
|
|
11
|
-
<figcaption>{{title}}</figcaption>
|
|
12
|
-
</figure>
|