relaton-bib 1.3.0 → 1.5.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +44 -18
- data/grammars/isodoc.rng +130 -21
- data/grammars/reqt.rng +2 -8
- data/lib/relaton_bib.rb +3 -1
- data/lib/relaton_bib/biblio_note.rb +27 -0
- data/lib/relaton_bib/bibliographic_date.rb +2 -1
- data/lib/relaton_bib/bibliographic_item.rb +60 -40
- data/lib/relaton_bib/bibtex_parser.rb +16 -15
- data/lib/relaton_bib/contribution_info.rb +14 -8
- data/lib/relaton_bib/contributor.rb +10 -6
- data/lib/relaton_bib/copyright_association.rb +7 -5
- data/lib/relaton_bib/document_identifier.rb +38 -9
- data/lib/relaton_bib/document_relation.rb +2 -2
- data/lib/relaton_bib/document_relation_collection.rb +0 -2
- data/lib/relaton_bib/document_status.rb +0 -3
- data/lib/relaton_bib/editorial_group.rb +5 -0
- data/lib/relaton_bib/hash_converter.rb +11 -13
- data/lib/relaton_bib/hit.rb +10 -6
- data/lib/relaton_bib/hit_collection.rb +8 -3
- data/lib/relaton_bib/localized_string.rb +4 -4
- data/lib/relaton_bib/organization.rb +26 -15
- data/lib/relaton_bib/person.rb +27 -14
- data/lib/relaton_bib/place.rb +1 -1
- data/lib/relaton_bib/typed_title_string.rb +67 -0
- data/lib/relaton_bib/version.rb +1 -1
- data/lib/relaton_bib/xml_parser.rb +16 -7
- metadata +7 -7
data/lib/relaton_bib/version.rb
CHANGED
@@ -20,7 +20,7 @@ module RelatonBib
|
|
20
20
|
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
21
21
|
|
22
22
|
# @return [Hash]
|
23
|
-
def item_data(bibitem) # rubocop:disable Metrics/CyclomaticComplexity
|
23
|
+
def item_data(bibitem) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
24
24
|
ext = bibitem.at "//ext"
|
25
25
|
{
|
26
26
|
id: bibitem[:id]&.empty? ? nil : bibitem[:id],
|
@@ -75,7 +75,7 @@ module RelatonBib
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def fetch_note(item)
|
78
|
-
item.xpath("./note").map do |n|
|
78
|
+
bnotes = item.xpath("./note").map do |n|
|
79
79
|
BiblioNote.new(
|
80
80
|
content: n.text,
|
81
81
|
type: n[:type],
|
@@ -84,6 +84,7 @@ module RelatonBib
|
|
84
84
|
script: n[:script]
|
85
85
|
)
|
86
86
|
end
|
87
|
+
BiblioNoteCollection.new bnotes
|
87
88
|
end
|
88
89
|
|
89
90
|
def fetch_language(item)
|
@@ -98,7 +99,7 @@ module RelatonBib
|
|
98
99
|
end
|
99
100
|
end
|
100
101
|
|
101
|
-
def fetch_series(item) # rubocop:disable Metrics/CyclomaticComplexity,
|
102
|
+
def fetch_series(item) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/AbcSize,Metrics/MethodLength,Metrics/PerceivedComplexity
|
102
103
|
item.xpath("./series").reduce([]) do |mem, sr|
|
103
104
|
abbr = sr.at "abbreviation"
|
104
105
|
abbreviation = abbr &&
|
@@ -164,10 +165,15 @@ module RelatonBib
|
|
164
165
|
end
|
165
166
|
end
|
166
167
|
|
168
|
+
# @param item [Nokogiri::XML::Element]
|
169
|
+
# @return [RelatonBib::TypedTitleStringCollection]
|
167
170
|
def fetch_titles(item)
|
168
|
-
item.xpath("./title").map { |t| ttitle t }
|
171
|
+
ttl = item.xpath("./title").map { |t| ttitle t }
|
172
|
+
TypedTitleStringCollection.new ttl
|
169
173
|
end
|
170
174
|
|
175
|
+
# @param title [Nokogiri::XML::Element]
|
176
|
+
# @return [RelatonBib::TypedTitleString]
|
171
177
|
def ttitle(title)
|
172
178
|
return unless title
|
173
179
|
|
@@ -202,7 +208,9 @@ module RelatonBib
|
|
202
208
|
abbreviation: elm[:abbreviation])
|
203
209
|
end
|
204
210
|
|
205
|
-
|
211
|
+
# @param node [Nokogiri::XML::Elemen]
|
212
|
+
# @return [Array<RelatonBib::BibliographicDate>]
|
213
|
+
def fetch_dates(item) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
206
214
|
item.xpath("./date").reduce([]) do |a, d|
|
207
215
|
type = d[:type].to_s.empty? ? "published" : d[:type]
|
208
216
|
if (on = d.at("on"))
|
@@ -222,14 +230,15 @@ module RelatonBib
|
|
222
230
|
identifier = org.xpath("./identifier").map do |i|
|
223
231
|
OrgIdentifier.new(i[:type], i.text)
|
224
232
|
end
|
233
|
+
subdiv = org.xpath("subdivision").map &:text
|
225
234
|
Organization.new(name: names,
|
226
235
|
abbreviation: org.at("abbreviation")&.text,
|
227
|
-
subdivision:
|
236
|
+
subdivision: subdiv,
|
228
237
|
url: org.at("uri")&.text,
|
229
238
|
identifier: identifier)
|
230
239
|
end
|
231
240
|
|
232
|
-
def get_person(person) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity
|
241
|
+
def get_person(person) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
233
242
|
affiliations = person.xpath("./affiliation").map do |a|
|
234
243
|
org = a.at "./organization"
|
235
244
|
desc = a.xpath("./description").map do |e|
|
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.
|
4
|
+
version: 1.5.pre1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08
|
11
|
+
date: 2020-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -248,7 +248,7 @@ homepage: https://github.com/relaton/relaton-bib
|
|
248
248
|
licenses:
|
249
249
|
- BSD-2-Clause
|
250
250
|
metadata: {}
|
251
|
-
post_install_message:
|
251
|
+
post_install_message:
|
252
252
|
rdoc_options: []
|
253
253
|
require_paths:
|
254
254
|
- lib
|
@@ -259,12 +259,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
259
259
|
version: 2.4.0
|
260
260
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
261
261
|
requirements:
|
262
|
-
- - "
|
262
|
+
- - ">"
|
263
263
|
- !ruby/object:Gem::Version
|
264
|
-
version:
|
264
|
+
version: 1.3.1
|
265
265
|
requirements: []
|
266
266
|
rubygems_version: 3.0.6
|
267
|
-
signing_key:
|
267
|
+
signing_key:
|
268
268
|
specification_version: 4
|
269
269
|
summary: 'RelatonBib: Ruby XMLDOC impementation.'
|
270
270
|
test_files: []
|