bookify 2.5.0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bookify/node/image.rb +10 -2
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e07bd5f6f7148fa8711de2c1cf860236e3e3da1dd4fd411246c11b15958ac49
4
- data.tar.gz: 2995c7ec5a3fef4fee1d8a837d77d253b99998d7bfb2e6a2465e067b142e9da1
3
+ metadata.gz: 4255cf2b6bf6760ab6e48f513e5b72d39c76a524052a900801445462743cfd20
4
+ data.tar.gz: d8ddad7073160d14d02bcfcc366f7067af49f0bd73edbaba0739ee3db0e2f57b
5
5
  SHA512:
6
- metadata.gz: 44b913b44ff68a55071a0fbe5f88f7d8195872b6bc0deb39382d9b095b3a767d8c0b4cc183b80a9e32e001845bb421f5004b63a7189380981a8244ce8b07debe
7
- data.tar.gz: ecb58a77471a62ad08a749bef069ae9642b9b318bcd2bb0c232326ec352d33bec34a952abfba672304fc712f0c6a41c27c506caa6cc40e898440892d086c7f81
6
+ metadata.gz: bfa67e29bf649746630e7352d5892d46616a9cd463ff937fd06dd6b5d4c69f870af036e33d993af1fd9a8ea49c2e80eb116da3c3191bdd5552a0e82f413375a2
7
+ data.tar.gz: c37247ac47f1df3703933e78b546f6ccea7c6e10964abbad50b0a23e4460e335c167376aa5d03ca34832ef7ab93f27cc0f6c1077c67cc156618ecc29a9774fcd
@@ -1,15 +1,23 @@
1
1
  require_relative "base"
2
+ require "open-uri"
2
3
 
3
4
  module Bookify::Node
4
5
  class Image < Base
5
6
  def render
6
7
  options = {
7
8
  position: html_classes.include?("center") ? :center : :left,
8
- fit: [bounds.width, -1],
9
+ fit: [bounds.width, -1]
9
10
  }
10
11
 
11
- image node.attr(:src), options
12
+ image image_from_node(node), options
12
13
  move_down 15
13
14
  end
15
+
16
+ private
17
+
18
+ def image_from_node(node)
19
+ src = node.attr(:src)
20
+ /^https?\:\/\//.match?(src) ? URI.open(src) : src
21
+ end
14
22
  end
15
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bookify
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joey Schoblaska
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-14 00:00:00.000000000 Z
11
+ date: 2020-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake