jekyll-thumbor 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.bumpversion.cfg +3 -8
- data/.travis.yml +0 -4
- data/Gemfile.lock +2 -2
- data/README.md +10 -0
- data/appveyor.yml +1 -1
- data/jekyll-thumbor.gemspec +1 -1
- data/lib/jekyll/thumbor_tag/version.rb +5 -0
- data/lib/jekyll/thumbor_tag.rb +19 -19
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc16e805534c4b29e22e016579e879505e0bad6c
|
4
|
+
data.tar.gz: 2cb1bc7de8c620963fe6cfe021809dbf6a9f868d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7fb479893313be077ff7e0092266f80023d615f9bf62da2b6d5ca3fa94bc3e3f1c75099823da67bac0166917511f781000ae3181e95d45923705a2ec280241b
|
7
|
+
data.tar.gz: 371ab1697454f68fc236488858b75287c0aa8b99e71db21c9c640d9c1fe9496784aba0157842944f0e15705e336b75c6feb90892b33313baa48702dc10b028cb
|
data/.bumpversion.cfg
CHANGED
@@ -1,16 +1,11 @@
|
|
1
1
|
[bumpversion]
|
2
|
-
current_version = 0.
|
3
|
-
commit =
|
2
|
+
current_version = 0.4.0
|
3
|
+
commit = True
|
4
4
|
tag = False
|
5
5
|
message = :bookmark: {current_version} → {new_version}
|
6
6
|
|
7
|
-
[bumpversion:file:.travis.yml]
|
8
|
-
search = pkg/jekyll-thumbor-{current_version}.gem
|
9
|
-
replace = pkg/jekyll-thumbor-{new_version}.gem
|
10
|
-
|
11
7
|
[bumpversion:file:appveyor.yml]
|
12
8
|
search = v{current_version}
|
13
9
|
replace = v{new_version}
|
14
10
|
|
15
|
-
[bumpversion:file:lib/jekyll/thumbor_tag.rb]
|
16
|
-
|
11
|
+
[bumpversion:file:lib/jekyll/thumbor_tag/version.rb]
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -31,6 +31,16 @@ gems:
|
|
31
31
|
|
32
32
|
## Usage
|
33
33
|
|
34
|
+
You need to add an array for thumbor configuration to your `_config.yml` file:
|
35
|
+
|
36
|
+
```yaml
|
37
|
+
thumbor:
|
38
|
+
url: "https://your-thumbor-server"
|
39
|
+
key: "your-key"
|
40
|
+
```
|
41
|
+
|
42
|
+
Then in the liquid template you can use the template tag:
|
43
|
+
|
34
44
|
```html
|
35
45
|
<img src="{% thumbor_tag https://example.org/picture.jpg, width: 500, height: 500 %}"
|
36
46
|
```
|
data/appveyor.yml
CHANGED
data/jekyll-thumbor.gemspec
CHANGED
data/lib/jekyll/thumbor_tag.rb
CHANGED
@@ -2,33 +2,33 @@ require "liquid"
|
|
2
2
|
require "ruby-thumbor"
|
3
3
|
|
4
4
|
module Jekyll
|
5
|
-
|
5
|
+
module ThumborTag
|
6
|
+
class ThumborTag < Liquid::Tag
|
6
7
|
|
7
|
-
|
8
|
+
def initialize(tag_name, text, tokens)
|
9
|
+
super
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
+
tokens = text.split /\,\s/
|
12
|
+
@url = tokens[0]
|
13
|
+
@parameters = {}
|
11
14
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
k, v = arg.split /:/
|
18
|
-
v ||= "1"
|
19
|
-
@parameters[k.strip] = v.strip
|
15
|
+
tokens[1..-1].each do |arg|
|
16
|
+
k, v = arg.split /:/
|
17
|
+
v ||= "1"
|
18
|
+
@parameters[k.strip] = v.strip
|
19
|
+
end
|
20
20
|
end
|
21
|
-
end
|
22
21
|
|
23
|
-
|
24
|
-
|
22
|
+
def render(context)
|
23
|
+
@config = context.registers[:site].config['thumbor']
|
25
24
|
|
26
|
-
|
27
|
-
|
25
|
+
image = Thumbor::Cascade.new(@config['key'], @url)
|
26
|
+
image_url = image.width(@parameters['width']).height(@parameters['height']).generate
|
28
27
|
|
29
|
-
|
28
|
+
"#{@config['url']}#{image_url}"
|
29
|
+
end
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
Liquid::Template.register_tag('thumbor', Jekyll::ThumborTag)
|
34
|
+
Liquid::Template.register_tag('thumbor', Jekyll::ThumborTag::ThumborTag)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-thumbor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Myles Braithwaite
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-thumbor
|
@@ -108,6 +108,7 @@ files:
|
|
108
108
|
- jekyll-thumbor.gemspec
|
109
109
|
- lib/jekyll-thumbor.rb
|
110
110
|
- lib/jekyll/thumbor_tag.rb
|
111
|
+
- lib/jekyll/thumbor_tag/version.rb
|
111
112
|
homepage: http://myles.github.io/jekyll-thumbor/
|
112
113
|
licenses:
|
113
114
|
- MIT
|