relaton-bib 1.9.6 → 1.9.10
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 +10 -8
- data/lib/relaton_bib/bibxml_parser.rb +8 -6
- data/lib/relaton_bib/contribution_info.rb +3 -1
- data/lib/relaton_bib/editorial_group.rb +1 -1
- data/lib/relaton_bib/person.rb +3 -3
- data/lib/relaton_bib/typed_title_string.rb +3 -3
- 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: 944fd26ef5c5b32d7a9a5023bc1c2291f6bfb772814c19bfd214dc951449186c
|
|
4
|
+
data.tar.gz: 0b168752f3e1c622cdcb04c24b7f8e0d492bea3617b0e8bbcb1e2e388717e3ce
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6a0ee9af618a698c0ff2552185f4520e1bb37023ee0b51d5c8757a1a9b490631b589d5da49203cd099460d1807f1e1f2e71a85eb0cda25841e17cc9fecbcc124
|
|
7
|
+
data.tar.gz: f4f8cdc21e0320d29f5c40d7732fbb9af3fea8fd3c3db4b841895f8c316eaa88ce5e3033038f05b7e278f1fd31501f0a9e75b26e79ccab55137619b19dc47660
|
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
|
|
@@ -828,10 +829,11 @@ module RelatonBib
|
|
|
828
829
|
builder.seriesInfo(name: di.type, value: di.id)
|
|
829
830
|
end
|
|
830
831
|
end
|
|
831
|
-
|
|
832
|
-
series.
|
|
833
|
-
|
|
834
|
-
|
|
832
|
+
di_types = docidentifier.map(&:type)
|
|
833
|
+
series.select do |s|
|
|
834
|
+
s.title && !di_types.include?(s.title.title.to_s) &&
|
|
835
|
+
!BibXMLParser::SERIESINFONAMES.include?(s.title.title.to_s)
|
|
836
|
+
end.uniq { |s| s.title.title.to_s }.each do |s|
|
|
835
837
|
si = builder.seriesInfo(name: s.title.title.to_s)
|
|
836
838
|
si[:value] = s.number if s.number
|
|
837
839
|
end
|
|
@@ -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)
|
|
@@ -138,10 +139,9 @@ module RelatonBib
|
|
|
138
139
|
# @return [Array<RelatonBib::FormattedString>]
|
|
139
140
|
def abstracts(ref)
|
|
140
141
|
ref.xpath("./front/abstract").map do |a|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
)
|
|
142
|
+
c = a.children.to_s.gsub(/\s*(<\/?)t(>)\s*/, '\1p\2').gsub(/\n/, "").squeeze " "
|
|
143
|
+
FormattedString.new(content: c, language: language(ref), script: "Latn",
|
|
144
|
+
format: "text/html")
|
|
145
145
|
end
|
|
146
146
|
end
|
|
147
147
|
|
|
@@ -288,6 +288,8 @@ module RelatonBib
|
|
|
288
288
|
d = [date[:year], month(date[:month]), (date[:day] || 1)].compact.join "-"
|
|
289
289
|
date = Time.parse(d).strftime "%Y-%m-%d"
|
|
290
290
|
[BibliographicDate.new(type: "published", on: date)]
|
|
291
|
+
rescue ArgumentError
|
|
292
|
+
[]
|
|
291
293
|
end
|
|
292
294
|
|
|
293
295
|
# @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]
|
data/lib/relaton_bib/person.rb
CHANGED
|
@@ -189,8 +189,8 @@ module RelatonBib
|
|
|
189
189
|
# @option opts [String, Symbol] :lang language
|
|
190
190
|
def to_xml(**opts)
|
|
191
191
|
opts[:builder].person do |builder|
|
|
192
|
-
name.to_xml
|
|
193
|
-
affiliation.each { |a| a.to_xml
|
|
192
|
+
name.to_xml(**opts)
|
|
193
|
+
affiliation.each { |a| a.to_xml(**opts) }
|
|
194
194
|
identifier.each { |id| id.to_xml builder }
|
|
195
195
|
contact.each { |contact| contact.to_xml builder }
|
|
196
196
|
end
|
|
@@ -210,7 +210,7 @@ module RelatonBib
|
|
|
210
210
|
# @count [Integer] number of persons
|
|
211
211
|
# @return [String]
|
|
212
212
|
def to_asciibib(prefix = "", count = 1) # rubocop:disable Metrics/AbcSize
|
|
213
|
-
pref = prefix.sub
|
|
213
|
+
pref = prefix.sub(/\*$/, "person")
|
|
214
214
|
out = count > 1 ? "#{pref}::\n" : ""
|
|
215
215
|
out += name.to_asciibib pref
|
|
216
216
|
affiliation.each { |af| out += af.to_asciibib pref, affiliation.size }
|
|
@@ -72,6 +72,8 @@ module RelatonBib
|
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
class TypedTitleString
|
|
75
|
+
ARGS = %i[content language script format].freeze
|
|
76
|
+
|
|
75
77
|
# @return [String]
|
|
76
78
|
attr_reader :type
|
|
77
79
|
|
|
@@ -93,9 +95,7 @@ module RelatonBib
|
|
|
93
95
|
if args[:title]
|
|
94
96
|
@title = args[:title]
|
|
95
97
|
else
|
|
96
|
-
fsargs = args.select
|
|
97
|
-
%i[content language script format].include? k
|
|
98
|
-
end
|
|
98
|
+
fsargs = args.select { |k, _v| ARGS.include? k }
|
|
99
99
|
@title = FormattedString.new(**fsargs)
|
|
100
100
|
end
|
|
101
101
|
end
|
|
@@ -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.10
|
|
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-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: byebug
|