jekyll-bits 0.5 → 0.6
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 +4 -4
- data/README.md +1 -0
- data/jekyll-bits.gemspec +1 -1
- data/lib/jekyll-bits/picture.rb +10 -2
- data/test/test_picture.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ec9d0aaf051e1422379bb6288efb78a6966a98f1
|
|
4
|
+
data.tar.gz: d098833193da98cd60580a7291b82def12f24321
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: de8508ffcb161fbc05ff81e5ff234cbc54b47d0fd5ef8276cf5aeef144a49c9aa76c812efc88c94469e63667535f1fc003f24668068eec5dd292dc9ee700b4b9
|
|
7
|
+
data.tar.gz: 7b3b045704e9139335da5b025f9ea948403e80db55396485a88b84de726497c9bf3d04e49d1148c948f62b8cc5e223afc52a877e73aaa2bfe7f1f4893cbacaa1
|
data/.rubocop.yml
CHANGED
|
@@ -3,8 +3,8 @@ AllCops:
|
|
|
3
3
|
|
|
4
4
|
Style/FileName:
|
|
5
5
|
Enabled: false
|
|
6
|
-
MethodLength:
|
|
7
|
-
Max:
|
|
6
|
+
Metrics/MethodLength:
|
|
7
|
+
Max: 50
|
|
8
8
|
Metrics/BlockLength:
|
|
9
9
|
Max: 50
|
|
10
10
|
Style/ConditionalAssignment:
|
|
@@ -12,6 +12,6 @@ Style/ConditionalAssignment:
|
|
|
12
12
|
Metrics/PerceivedComplexity:
|
|
13
13
|
Max: 20
|
|
14
14
|
Metrics/CyclomaticComplexity:
|
|
15
|
-
Max:
|
|
15
|
+
Max: 20
|
|
16
16
|
Metrics/AbcSize:
|
|
17
|
-
Max:
|
|
17
|
+
Max: 60
|
data/README.md
CHANGED
data/jekyll-bits.gemspec
CHANGED
|
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
|
8
8
|
s.rubygems_version = '2.2.2'
|
|
9
9
|
s.required_ruby_version = '>= 1.9.3'
|
|
10
10
|
s.name = 'jekyll-bits'
|
|
11
|
-
s.version = '0.
|
|
11
|
+
s.version = '0.6'
|
|
12
12
|
s.license = 'MIT'
|
|
13
13
|
s.summary = 'Jekyll Bits'
|
|
14
14
|
s.description = 'Useful and very simple Jekyll plugins'
|
data/lib/jekyll-bits/picture.rb
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
23
|
# SOFTWARE.
|
|
24
24
|
|
|
25
|
+
require 'digest/md5'
|
|
25
26
|
require 'liquid'
|
|
26
27
|
|
|
27
28
|
# Jekyll module
|
|
@@ -53,10 +54,15 @@ module Jekyll
|
|
|
53
54
|
if yaml.is_a?(Hash)
|
|
54
55
|
raise "src is absent for jb_picture in #{page.url}" unless yaml['src']
|
|
55
56
|
html += CGI.escapeElement(yaml['src'])
|
|
57
|
+
md5 = Digest::MD5.new.hexdigest(yaml['src'])
|
|
56
58
|
else
|
|
57
59
|
html += yaml
|
|
60
|
+
md5 = Digest::MD5.new.hexdigest(yaml)
|
|
58
61
|
end
|
|
62
|
+
md5 = md5[0, 8]
|
|
59
63
|
html += "'"
|
|
64
|
+
html += " longdesc='##{md5}'" \
|
|
65
|
+
if yaml.is_a?(Hash) && yaml['caption']
|
|
60
66
|
html += " width='#{yaml['width']}'" \
|
|
61
67
|
if yaml.is_a?(Hash) && yaml['width']
|
|
62
68
|
html += " height='#{yaml['height']}'" \
|
|
@@ -65,8 +71,10 @@ module Jekyll
|
|
|
65
71
|
html = "<a href='#{CGI.escapeHTML(yaml['href'])}'>#{html}</a>" \
|
|
66
72
|
if yaml.is_a?(Hash) && yaml['href']
|
|
67
73
|
html = "<figure class='jb_picture'>" + html
|
|
68
|
-
|
|
69
|
-
|
|
74
|
+
if yaml.is_a?(Hash) && yaml['caption']
|
|
75
|
+
html += "<figcaption id='#{md5}'>" \
|
|
76
|
+
"#{CGI.escapeHTML(yaml['caption'])}</figcaption>"
|
|
77
|
+
end
|
|
70
78
|
html + '</figure>'
|
|
71
79
|
end
|
|
72
80
|
end
|
data/test/test_picture.rb
CHANGED
|
@@ -65,7 +65,7 @@ module Jekyll
|
|
|
65
65
|
)
|
|
66
66
|
assert_match(/figcaption/, html)
|
|
67
67
|
assert_match(/figure/, html)
|
|
68
|
-
assert_match(/<figcaption>it is <simple>/, html)
|
|
68
|
+
assert_match(/<figcaption id='d9d1da45'>it is <simple>/, html)
|
|
69
69
|
assert_match(/alt='nothing 'to' say'/, html)
|
|
70
70
|
assert_match(/width='500'/, html)
|
|
71
71
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jekyll-bits
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: '0.
|
|
4
|
+
version: '0.6'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yegor Bugayenko
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2017-01-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: jekyll
|
|
@@ -163,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
163
163
|
version: '0'
|
|
164
164
|
requirements: []
|
|
165
165
|
rubyforge_project:
|
|
166
|
-
rubygems_version: 2.4.5.
|
|
166
|
+
rubygems_version: 2.4.5.2
|
|
167
167
|
signing_key:
|
|
168
168
|
specification_version: 2
|
|
169
169
|
summary: Jekyll Bits
|