booklab-sml 0.5.0 → 0.5.1

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
  SHA256:
3
- metadata.gz: 551b90eee459ea8cc8ec51a6b90ba28f1db3a74b57d1fe4fa6b9818957761153
4
- data.tar.gz: d77a9300d3d03a89de457f692069aeaf41b6f441abd4484b0a77739e586ed447
3
+ metadata.gz: 6f2be0239f156ad88b94d4ea2b004323ad2103fc5f40a464978888218368757b
4
+ data.tar.gz: 1c8216e99a9c7726d73babb29c9131bfaad8b43edf6e273a2844458b8ba697cd
5
5
  SHA512:
6
- metadata.gz: 6edcc789f0f393c766002436504723880c865dd9614ed8da5a2910cf1bd9b048bfd154d281c20bd2487e0f16b2f9305d05877bbb808d5b71c5138b28d8dc3e5d
7
- data.tar.gz: e265252f0aa382d527f623fb32ee5776e8bf3040b7822b7a9c04c32b4ccd97d5e96a55750fe07c8dd221b5526b609c91898cbbe73d50f5b9e4cfabdbdc2e7f74
6
+ metadata.gz: 3036a182310d3de012c563b8caec72944e268995fc264a77a8b1aee0e635ab296de19c0b703551f11ef427a6b76dfcd1560d3056947d61d83e1c92a3ae53e2ee
7
+ data.tar.gz: c42ae23213f09e67f32e551be9ca9af2c48ddef2ea745848f0f2c0e600469317abaee72a40747ec1f06208f1c22042e927a45d8e1165ea0943ca0efe92e0717e
@@ -60,6 +60,9 @@ module BookLab::SML::Rules
60
60
  end
61
61
 
62
62
  def self.html_attrs(attrs)
63
+ attrs[:width] = nil if attrs[:width].to_i == 0
64
+ attrs[:height] = nil if attrs[:height].to_i == 0
65
+
63
66
  props = attrs.map { |k, v| v.present? ? %(#{k}="#{v}") : nil }.compact.join(" ")
64
67
  %( #{props})
65
68
  end
@@ -12,15 +12,14 @@ module BookLab::SML::Rules
12
12
 
13
13
  return attrs[:name] if attrs[:src].blank?
14
14
 
15
- html_attrs = {
15
+ attr_html = html_attrs(
16
16
  src: attrs[:src],
17
17
  alt: attrs[:name],
18
18
  width: attrs[:width],
19
19
  height: attrs[:height]
20
- }
20
+ )
21
21
 
22
- attr_html = html_attrs.map { |k, v| v.present? ? %(#{k}="#{v}") : nil }.compact.join(" ")
23
- %(<img #{attr_html}>)
22
+ %(<img#{attr_html}>)
24
23
  end
25
24
  end
26
25
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module BookLab
4
4
  module SML
5
- VERSION = "0.5.0"
5
+ VERSION = "0.5.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: booklab-sml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-30 00:00:00.000000000 Z
11
+ date: 2019-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport