bridgetown-cloudinary 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +4 -0
- data/bridgetown.automation.rb +15 -0
- data/lib/bridgetown-cloudinary/builder.rb +16 -9
- data/lib/bridgetown-cloudinary/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c832350f15549d90fda2675a21394484540b271aa4e27a6d2ddacfa1987b5c3c
|
4
|
+
data.tar.gz: 7766d51b45ffce0aeaaa9909846a4a07be7c9a351960513bd13f81f3ef59c010
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff868191020b3b4dd248f8b35bc1e0a77a4904408798d1c0603e7524724c51e044650fe333fc8c5a42390a238df38f75b1f6db773ea69f7b2465452aee3f83ff
|
7
|
+
data.tar.gz: be185570e71ef19e4916668894f9e05de78899ec31189c8633516152689b54ed6c4634f845a6c8eb6c22f48d832d8d66136c17beb16d19fae02757f7b4b3f1ca
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -9,6 +9,10 @@ This plugin wires the two up so you can use Cloudinary images in your blog posts
|
|
9
9
|
articles, product pages, site templates, and anywhere else you might need to
|
10
10
|
reference media optimized for mobile and responsive design.
|
11
11
|
|
12
|
+
(_Note: For users who may be familiar with the jekyll-cloudinary plugin, this is
|
13
|
+
unrelated and the usage is quite different. This plugin assumes you store your
|
14
|
+
images in Cloudinary directly, not your repo._)
|
15
|
+
|
12
16
|
## Installation
|
13
17
|
|
14
18
|
Run this command to add this plugin to your site's Gemfile:
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Supporting the upcoming automation feature
|
2
|
+
|
3
|
+
say_status "Cloudinary", "Installing the bridgetown-cloudinary plugin..."
|
4
|
+
|
5
|
+
cloud_name = ask("What's your Cloudinary cloud name?")
|
6
|
+
|
7
|
+
add_bridgetown_plugin "bridgetown-cloudinary"
|
8
|
+
|
9
|
+
append_to_file "bridgetown.config.yml" do
|
10
|
+
<<~YAML
|
11
|
+
|
12
|
+
cloudinary:
|
13
|
+
cloud_name: #{cloud_name}
|
14
|
+
YAML
|
15
|
+
end
|
@@ -42,15 +42,8 @@ module Bridgetown
|
|
42
42
|
# Define the "cloudinary_img" Liquid tag
|
43
43
|
def img_tag(attributes, tag)
|
44
44
|
alt, id, transformation = attributes.split(",").map(&:strip)
|
45
|
-
alt.
|
46
|
-
|
47
|
-
id.delete! '"'
|
48
|
-
elsif id.include? "."
|
49
|
-
obj, var = id.split(".")
|
50
|
-
id = tag.context[obj][var]
|
51
|
-
else
|
52
|
-
id = tag.context[id]
|
53
|
-
end
|
45
|
+
alt = variable_in_context(alt, tag.context)
|
46
|
+
id = variable_in_context(id, tag.context)
|
54
47
|
transformation&.delete! '"'
|
55
48
|
|
56
49
|
"<img alt=\"#{alt}\" src=\"#{url_filter(id, transformation)}\" />"
|
@@ -62,6 +55,20 @@ module Bridgetown
|
|
62
55
|
config: config[:cloudinary], id: id, transformation: transformation
|
63
56
|
)
|
64
57
|
end
|
58
|
+
|
59
|
+
protected
|
60
|
+
|
61
|
+
def variable_in_context(variable, tag_context)
|
62
|
+
if variable.include? '"'
|
63
|
+
variable.delete! '"'
|
64
|
+
elsif variable.include? "."
|
65
|
+
obj, var = variable.split(".")
|
66
|
+
variable = tag_context[obj][var]
|
67
|
+
else
|
68
|
+
variable = tag_context[variable]
|
69
|
+
end
|
70
|
+
variable
|
71
|
+
end
|
65
72
|
end
|
66
73
|
end
|
67
74
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bridgetown-cloudinary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bridgetown Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bridgetown
|
@@ -129,6 +129,7 @@ files:
|
|
129
129
|
- README.md
|
130
130
|
- Rakefile
|
131
131
|
- bridgetown-cloudinary.gemspec
|
132
|
+
- bridgetown.automation.rb
|
132
133
|
- lib/bridgetown-cloudinary.rb
|
133
134
|
- lib/bridgetown-cloudinary/builder.rb
|
134
135
|
- lib/bridgetown-cloudinary/utils.rb
|