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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 162d0a9061d3e1902780dd3b30948da8a6498b1d
4
- data.tar.gz: feb40e9c53871753e24f71b29fee3f25c92916b1
3
+ metadata.gz: ec9d0aaf051e1422379bb6288efb78a6966a98f1
4
+ data.tar.gz: d098833193da98cd60580a7291b82def12f24321
5
5
  SHA512:
6
- metadata.gz: f7c5f566cb617f5db19ce11d47cb61d026f223e4c31a7ed59d48ac3033eb6b41488779e73b89bc93de46012c778c97026d6b719a6c16beb1749c243e6878359b
7
- data.tar.gz: 425bde36082f1a9fd24526e1d08984b08361c0a1875ece7d262c0afe8f971e1852f03bd4d883583f961302194b704d86841545ed8d036e485b4de36c42731a82
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: 30
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
15
+ Max: 20
16
16
  Metrics/AbcSize:
17
- Max: 40
17
+ Max: 60
data/README.md CHANGED
@@ -72,6 +72,7 @@ Something like that will be rendered:
72
72
  <a href='...'>
73
73
  <img alt='...' src='...'/>
74
74
  </a>
75
+ <figcaption>...</figcaption>
75
76
  </figure>
76
77
  ```
77
78
 
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.5'
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'
@@ -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
- html += "<figcaption>#{CGI.escapeHTML(yaml['caption'])}</figcaption>" \
69
- if yaml.is_a?(Hash) && yaml['caption']
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 &lt;simple&gt;/, html)
68
+ assert_match(/<figcaption id='d9d1da45'>it is &lt;simple&gt;/, html)
69
69
  assert_match(/alt='nothing &#39;to&#39; 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.5'
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: 2016-12-25 00:00:00.000000000 Z
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.1
166
+ rubygems_version: 2.4.5.2
167
167
  signing_key:
168
168
  specification_version: 2
169
169
  summary: Jekyll Bits