relaton-bib 1.19.2 → 1.19.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/relaton_bib/image.rb +18 -19
- data/lib/relaton_bib/localized_string.rb +1 -1
- data/lib/relaton_bib/version.rb +1 -1
- data/lib/relaton_bib/xml_parser.rb +8 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f30aba03119323515ec5e39d4a257a15a4de1a83148eb6e45f1b21ba63e42e14
|
4
|
+
data.tar.gz: e2588577b331caa08e3396689fa76af66770961e5e76809765a4af3733eb41f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b20b0ad0f1677bb3ef51adadd220d37fb3a22d8791f20f8f442c0b9cf7235fd933d833f9a8958f911b577f096c2b350c94c0c3748543df078ac8ab7485686e29
|
7
|
+
data.tar.gz: 88fa4fdaf09a61417e022a6893d8d998247b49aad4454ad3b4182991b80a41e0cb0e911e01d1fb74463d1418499d3d97c99b2c2893759af9cbf79b0c58130197
|
data/lib/relaton_bib/image.rb
CHANGED
@@ -1,32 +1,29 @@
|
|
1
1
|
module RelatonBib
|
2
2
|
class Image
|
3
3
|
# @return [String]
|
4
|
-
|
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
|
14
|
-
# @option args [String] :
|
15
|
-
# @option args [String] :
|
16
|
-
# @option args [String] :
|
17
|
-
# @option args [String] :
|
18
|
-
# @option args [String] :
|
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(
|
21
|
-
@id = id
|
23
|
+
def initialize(src:, mimetype:, **args)
|
22
24
|
@src = src
|
23
25
|
@mimetype = mimetype
|
24
|
-
|
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" => { "
|
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 = "
|
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
|
data/lib/relaton_bib/version.rb
CHANGED
@@ -289,13 +289,17 @@ module RelatonBib
|
|
289
289
|
# @return [Array<RelatonBib::DocumentIdentifier>]
|
290
290
|
def fetch_docid(item)
|
291
291
|
item.xpath("./docidentifier").map do |id|
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
292
|
+
args = id.to_h.transform_keys(&:to_sym)
|
293
|
+
args[:id] = id.text
|
294
|
+
args[:primary] = id[:primary] == "true" ? true : nil
|
295
|
+
create_docid(**args)
|
296
296
|
end
|
297
297
|
end
|
298
298
|
|
299
|
+
def create_docid(**args)
|
300
|
+
DocumentIdentifier.new(**args)
|
301
|
+
end
|
302
|
+
|
299
303
|
# @param item [Nokogiri::XML::Element]
|
300
304
|
# @return [RelatonBib::TypedTitleStringCollection]
|
301
305
|
def fetch_titles(item)
|
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.
|
4
|
+
version: 1.19.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: 2024-
|
11
|
+
date: 2024-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|