obp-access 0.1.3 → 0.1.4

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: bb730bc50a9d42e2fab9002aa77d4bfd9c495324d8d7e3a2dc5ea88eacbcedc9
4
- data.tar.gz: 8be58734fa23ab768dfa1bbe2d4907b738ef602f8bfeadc9b0d5293ba22ccce9
3
+ metadata.gz: 3b3fda155513c49b50f81b401262456e78f63e55fb0ced23f8a54bf4577ee0af
4
+ data.tar.gz: 75070c8db35ae812f69f19bb55e536c9c9b3da5ec29a5846bd9d9cd53e6d5f2a
5
5
  SHA512:
6
- metadata.gz: 6b159d5f9b615f94cadaa30c0bbb75cedc4a1761abf712cd1160fb227fbdc8dc7c2413fded7002b2132d5aedf2284081b17b34bf3055e7beab3688bf6e6767bd
7
- data.tar.gz: 3c1fc77d1d229be553bc0b694eb16688dac4e2d0099fe0162bba4a51aa1de4c4a8978c8c6e4221bbae5d96f50771384be9efbec2e89f74cc6a0ad40f0b5403e8
6
+ metadata.gz: fcf54d0abc492eae8542e14e3313199be54bce5eb45fd454996a3c69dc8d5c7641a8a4bd58bbde701320c142d051ab186441b4ce47d39f47dba1774d6b329562
7
+ data.tar.gz: c19c3f486740f899e6e0ecad8479f78f34a7c9cf3cad8638c2eb5344408a2047e3f6f8e7222e31ea57ac7e1c79047709466c23795872c6bf238e8b076a31e77f
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2026-06-13 11:32:12 UTC using RuboCop version 1.86.1.
3
+ # on 2026-06-15 08:31:30 UTC using RuboCop version 1.86.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -8,7 +8,7 @@ module Obp
8
8
  end
9
9
 
10
10
  def match_node?
11
- super && node.css("img").any?
11
+ super && node.css("img").one?
12
12
  end
13
13
 
14
14
  private
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Obp
2
4
  class Access
3
5
  class Renderer
@@ -16,29 +18,30 @@ module Obp
16
18
  def content
17
19
  Nokogiri::XML::Builder.new do |xml|
18
20
  xml.public_send(:"fig-group") do
19
- render_caption(xml, node)
21
+ render_caption_from(xml, node)
20
22
  node.css("img").each { |img| render_figure(xml, img) }
21
23
  end
22
24
  end
23
25
  end
24
26
 
25
- def render_caption(xml, children)
26
- xml.label children.at(".sts-caption-label").content
27
- xml.caption do
28
- xml.title children.at(".sts-caption-title").content
29
- end
30
- end
31
-
32
27
  def render_figure(xml, img)
33
28
  xml.fig do
34
- div = img.previous
35
- xml.label div.at(".sts-caption-label").content
36
- xml.caption do
37
- xml.title div.at(".sts-caption-title").content
38
- end
29
+ # OBP HTML often places no caption between grouped imgs; guard accordingly.
30
+ render_caption_from(xml, img.previous_element) if img.previous_element
39
31
  xml.graphic("xlink:href": local_image_path(img))
40
32
  end
41
33
  end
34
+
35
+ def render_caption_from(xml, source)
36
+ label = source&.at(".sts-caption-label")
37
+ title = source&.at(".sts-caption-title")
38
+ xml.label label.content if label
39
+ return unless title
40
+
41
+ xml.caption do
42
+ xml.title title.content
43
+ end
44
+ end
42
45
  end
43
46
  end
44
47
  end
@@ -15,11 +15,12 @@ module Obp
15
15
  private
16
16
 
17
17
  def id
18
- node.parent.at_css("div.sts-tbx-label").text.strip
18
+ node.parent.at_css("div.sts-tbx-label")&.text&.strip || ""
19
19
  end
20
20
 
21
21
  def index
22
- node.path.match(/\[(\d+)\](?=\z)/)[1].to_i - 1
22
+ match = node.path.match(/\[(\d+)\](?=\z)/)
23
+ match ? match[1].to_i - 1 : 0
23
24
  end
24
25
 
25
26
  def normative_authorization
@@ -1,5 +1,5 @@
1
1
  module Obp
2
2
  class Access
3
- VERSION = "0.1.3".freeze
3
+ VERSION = "0.1.4".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: obp-access
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-06-13 00:00:00.000000000 Z
11
+ date: 2026-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri