relaton-bib 1.9.7 → 1.9.8
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 +4 -4
- data/.rubocop.yml +2 -0
- data/lib/relaton_bib/bibliographic_item.rb +5 -4
- data/lib/relaton_bib/bibxml_parser.rb +5 -2
- data/lib/relaton_bib/contribution_info.rb +3 -1
- data/lib/relaton_bib/editorial_group.rb +1 -1
- data/lib/relaton_bib/typed_uri.rb +2 -2
- data/lib/relaton_bib/version.rb +1 -1
- data/lib/relaton_bib.rb +3 -3
- 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: cea4f63e62a2c6abff013361c4851294799cee45bcbe44a52ee8158501505f5f
|
|
4
|
+
data.tar.gz: 1d973d98047232ff7167257beafc0ed339177b27eb878918d9bcf0cc8f7d7301
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e21ef90933920055d91d952e2b5513279d4dd61559ead7aebef9db0d7df4b15283bdd5d2cf77decb16d4e4f8d573f38c4c872582dfcdfbd0899703e4b8a9b152
|
|
7
|
+
data.tar.gz: 471d57586461900b6805df5c8d536591a2d0377e3da455af5708dbfa37aa13a4960bdee00f7c54de052763332de81b31f862dc9b4acc21a9992c3c52eba08d7a
|
data/.rubocop.yml
CHANGED
|
@@ -159,10 +159,11 @@ module RelatonBib
|
|
|
159
159
|
# @option copyright [String, NilClass] :to
|
|
160
160
|
# @option copyright [String, NilClass] :scope
|
|
161
161
|
#
|
|
162
|
-
# @param date [Array<Hash>]
|
|
162
|
+
# @param date [Array<Hash, RelatonBib::BibliographicDate>]
|
|
163
163
|
# @option date [String] :type
|
|
164
|
-
# @option date [String] :from
|
|
165
|
-
# @option date [String] :to
|
|
164
|
+
# @option date [String, nil] :from required if :on is nil
|
|
165
|
+
# @option date [String, nil] :to
|
|
166
|
+
# @option date [String, nil] :on required if :from is nil
|
|
166
167
|
#
|
|
167
168
|
# @param contributor [Array<Hash>]
|
|
168
169
|
# @option contributor [RealtonBib::Organization, RelatonBib::Person]
|
|
@@ -176,7 +177,7 @@ module RelatonBib
|
|
|
176
177
|
# @option abstract [String] :content
|
|
177
178
|
# @option abstract [String] :language
|
|
178
179
|
# @option abstract [String] :script
|
|
179
|
-
# @option abstract [String] :
|
|
180
|
+
# @option abstract [String] :format
|
|
180
181
|
#
|
|
181
182
|
# @param relation [Array<Hash>]
|
|
182
183
|
# @option relation [String] :type
|
|
@@ -67,11 +67,12 @@ module RelatonBib
|
|
|
67
67
|
#
|
|
68
68
|
def docids(reference, ver) # rubocop:disable Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity,Metrics/AbcSize
|
|
69
69
|
ret = []
|
|
70
|
-
sfid = reference.at("./seriesInfo[@name='#{self::FLAVOR}']",
|
|
70
|
+
sfid = reference.at("./seriesInfo[@name='#{self::FLAVOR}']",
|
|
71
|
+
"./front/seriesInfo[@name='#{self::FLAVOR}']")
|
|
71
72
|
if sfid
|
|
72
73
|
ret << DocumentIdentifier.new(type: sfid[:name], id: sfid[:value])
|
|
73
74
|
elsif self::FLAVOR && (id = (reference[:anchor] || reference[:docName] || reference[:number]))
|
|
74
|
-
ret << DocumentIdentifier.new(
|
|
75
|
+
ret << DocumentIdentifier.new(type: self::FLAVOR, id: id.sub(/^(RFC)/, "\\1 "))
|
|
75
76
|
end
|
|
76
77
|
if (id = reference[:anchor])
|
|
77
78
|
ret << DocumentIdentifier.new(type: "rfc-anchor", id: id)
|
|
@@ -288,6 +289,8 @@ module RelatonBib
|
|
|
288
289
|
d = [date[:year], month(date[:month]), (date[:day] || 1)].compact.join "-"
|
|
289
290
|
date = Time.parse(d).strftime "%Y-%m-%d"
|
|
290
291
|
[BibliographicDate.new(type: "published", on: date)]
|
|
292
|
+
rescue ArgumentError
|
|
293
|
+
[]
|
|
291
294
|
end
|
|
292
295
|
|
|
293
296
|
# @param reference [Nokogiri::XML::Element]
|
|
@@ -82,6 +82,8 @@ module RelatonBib
|
|
|
82
82
|
|
|
83
83
|
# @param entity [RelatonBib::Person, RelatonBib::Organization]
|
|
84
84
|
# @param role [Array<Hash>]
|
|
85
|
+
# @option role [String] :type
|
|
86
|
+
# @option role [Array<String>] :description
|
|
85
87
|
def initialize(entity:, role: [])
|
|
86
88
|
if role.empty?
|
|
87
89
|
role << { type: entity.is_a?(Person) ? "author" : "publisher" }
|
|
@@ -94,7 +96,7 @@ module RelatonBib
|
|
|
94
96
|
# @option opts [Nokogiri::XML::Builder] :builder XML builder
|
|
95
97
|
# @option opts [String, Symbol] :lang language
|
|
96
98
|
def to_xml(**opts)
|
|
97
|
-
entity.to_xml
|
|
99
|
+
entity.to_xml(**opts)
|
|
98
100
|
end
|
|
99
101
|
|
|
100
102
|
# @return [Hash]
|
|
@@ -5,7 +5,7 @@ module RelatonBib
|
|
|
5
5
|
class TypedUri
|
|
6
6
|
# @return [Symbol] :src/:obp/:rss
|
|
7
7
|
attr_reader :type
|
|
8
|
-
# @retutn [URI]
|
|
8
|
+
# @retutn [Addressable::URI]
|
|
9
9
|
attr_reader :content
|
|
10
10
|
|
|
11
11
|
# @param type [String, NilClass] src/obp/rss
|
|
@@ -37,7 +37,7 @@ module RelatonBib
|
|
|
37
37
|
# @param count [Integer] number of links
|
|
38
38
|
# @return [String]
|
|
39
39
|
def to_asciibib(prefix = "", count = 1)
|
|
40
|
-
pref = prefix.empty? ? "link" : prefix
|
|
40
|
+
pref = prefix.empty? ? "link" : "#{prefix}.link"
|
|
41
41
|
out = count > 1 ? "#{pref}::\n" : ""
|
|
42
42
|
out += "#{pref}.type:: #{type}\n" if type
|
|
43
43
|
out += "#{pref}.content:: #{content}\n"
|
data/lib/relaton_bib/version.rb
CHANGED
data/lib/relaton_bib.rb
CHANGED
|
@@ -14,9 +14,9 @@ module RelatonBib
|
|
|
14
14
|
class RequestError < StandardError; end
|
|
15
15
|
|
|
16
16
|
class << self
|
|
17
|
-
# @param date [String, Integer, Date]
|
|
18
|
-
# @param str [Boolean]
|
|
19
|
-
# @return [Date, nil]
|
|
17
|
+
# @param date [String, Integer, Date] date
|
|
18
|
+
# @param str [Boolean] return string or Date
|
|
19
|
+
# @return [Date, String, nil] date
|
|
20
20
|
def parse_date(date, str = true) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity,Metrics/AbcSize
|
|
21
21
|
return date if date.is_a?(Date)
|
|
22
22
|
|
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.9.
|
|
4
|
+
version: 1.9.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-12-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: byebug
|