relaton-bib 1.19.1 → 1.19.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20fdd20c795644afb49d384f59a61147d4161e0f10de362996a6537976bf1e2e
4
- data.tar.gz: 1d5f51e63402f944d4fad44e1884f8661af541a3cab52b37e46d2713acbf5d57
3
+ metadata.gz: d3a558692c0fed85db446e5e09bc97b88cd593b950c56deea611644a51ea541e
4
+ data.tar.gz: 5714aa8ce2e246e41477370b0562762b9ab242ae93c78ec71ef2d62e517ad54c
5
5
  SHA512:
6
- metadata.gz: e069c6c9ee0b670b354f0409993de0ded12e11515bc771b5da1b178345669b48d3328ffd13d14e30ebf5dbe56380500e7f7c1912d75482b438c0348f6b402021
7
- data.tar.gz: ba884104669e91900dfaca9ddbfa4ac6449b0bff33c6296f6bcb71947c3455c31e725eee3baeda12974a82e9861c3546ab45556a6c98aedc9f5f2812046ff8eb
6
+ metadata.gz: 034d246df4a77e85fe262e54bcab074747aa4260e3dfb17e619630e8181f3c3e869333099d69a2296a216d192e855496738eb29a8f6bcab08ac0ecedd8fbd395
7
+ data.tar.gz: 68df9e862afcdfd8f026647af0b0aa1e20c78fa50b08225f80cc7a950d450302fbc79f8e76c8741b6104b861c190ce6d587b1b64e7db96c8d43a7b93c45addd8
@@ -352,7 +352,7 @@ module RelatonBib
352
352
  # @option options [boolean, nil] :all_parts
353
353
  # @return [String]
354
354
  def shortref(identifier, **opts) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/AbcSize,Metrics/PerceivedComplexity
355
- pubdate = date.select { |d| d.type == "published" }
355
+ pubdate = date.select { |d| d.type == "published" || d.type == "issued" }
356
356
  year = if opts[:no_year] || pubdate.empty? then ""
357
357
  else ":#{pubdate&.first&.on(:year)}"
358
358
  end
@@ -1,32 +1,29 @@
1
1
  module RelatonBib
2
2
  class Image
3
3
  # @return [String]
4
- attr_reader :id, :src, :mimetype, :filename, :width, :height, :alt, :title, :longdesc
4
+ attr_accessor :src, :mimetype
5
+
6
+ # @return [String, nil]
7
+ attr_accessor :id, :filename, :width, :height, :alt, :title, :longdesc
5
8
 
6
9
  #
7
10
  # Initializes a new Image object.
8
11
  #
9
- # @param id [String] the ID of the image
10
12
  # @param src [String] the source URL of the image
11
13
  # @param mimetype [String] the MIME type of the image
12
14
  # @param args [Hash] additional arguments
13
- # @option args [String] :filename the filename of the image
14
- # @option args [String] :width the width of the image
15
- # @option args [String] :height the height of the image
16
- # @option args [String] :alt the alternative text for the image
17
- # @option args [String] :title the title of the image
18
- # @option args [String] :longdesc the long description of the image
15
+ # @option id [String, nil] the ID of the image
16
+ # @option args [String, nil] :filename the filename of the image
17
+ # @option args [String, nil] :width the width of the image
18
+ # @option args [String, nil] :height the height of the image
19
+ # @option args [String, nil] :alt the alternative text for the image
20
+ # @option args [String, nil] :title the title of the image
21
+ # @option args [String, nil] :longdesc the long description of the image
19
22
  #
20
- def initialize(id:, src:, mimetype:, **args)
21
- @id = id
23
+ def initialize(src:, mimetype:, **args)
22
24
  @src = src
23
25
  @mimetype = mimetype
24
- @filename = args[:filename]
25
- @width = args[:width]
26
- @height = args[:height]
27
- @alt = args[:alt]
28
- @title = args[:title]
29
- @longdesc = args[:longdesc]
26
+ args.each { |k, v| send "#{k}=", v }
30
27
  end
31
28
 
32
29
  def ==(other)
@@ -44,7 +41,7 @@ module RelatonBib
44
41
  #
45
42
  def to_xml(builder) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength
46
43
  builder.image do
47
- builder.parent[:id] = id
44
+ builder.parent[:id] = id if id
48
45
  builder.parent[:src] = src
49
46
  builder.parent[:mimetype] = mimetype
50
47
  builder.parent[:filename] = filename if filename
@@ -62,7 +59,8 @@ module RelatonBib
62
59
  # @return [Hash] The hash representation of the Image object.
63
60
  #
64
61
  def to_hash # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity
65
- hash = { "image" => { "id" => id, "src" => src, "mimetype" => mimetype } }
62
+ hash = { "image" => { "src" => src, "mimetype" => mimetype } }
63
+ hash["image"]["id"] = id if id
66
64
  hash["image"]["filename"] = filename if filename
67
65
  hash["image"]["width"] = width if width
68
66
  hash["image"]["height"] = height if height
@@ -81,7 +79,8 @@ module RelatonBib
81
79
  #
82
80
  def to_asciibib(prefix = "") # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity,Metrics/MethodLength
83
81
  pref = prefix.empty? ? "image." : "#{prefix}.image."
84
- out = "#{pref}id:: #{id}\n"
82
+ out = ""
83
+ out += "#{pref}id:: #{id}\n" if id
85
84
  out += "#{pref}src:: #{src}\n"
86
85
  out += "#{pref}mimetype:: #{mimetype}\n"
87
86
  out += "#{pref}filename:: #{filename}\n" if filename
@@ -1,3 +1,3 @@
1
1
  module RelatonBib
2
- VERSION = "1.19.1".freeze
2
+ VERSION = "1.19.3".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-bib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.19.1
4
+ version: 1.19.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-11 00:00:00.000000000 Z
11
+ date: 2024-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable