relaton-bib 1.1.0 → 1.1.1
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/.gitmodules +0 -3
- data/grammars/basicdoc.rng +986 -0
- data/grammars/biblio.rng +1237 -0
- data/grammars/isodoc.rng +1504 -0
- data/grammars/reqt.rng +171 -0
- data/lib/relaton_bib.rb +4 -1
- data/lib/relaton_bib/bibliographic_item.rb +119 -15
- data/lib/relaton_bib/document_relation_collection.rb +2 -2
- data/lib/relaton_bib/editorial_group.rb +27 -0
- data/lib/relaton_bib/hash_converter.rb +64 -21
- data/lib/relaton_bib/ics.rb +26 -0
- data/lib/relaton_bib/structured_identifier.rb +141 -0
- data/lib/relaton_bib/technical_committee.rb +25 -0
- data/lib/relaton_bib/typed_title_string.rb +36 -0
- data/lib/relaton_bib/version.rb +1 -1
- data/lib/relaton_bib/workgroup.rb +36 -0
- data/lib/relaton_bib/xml_parser.rb +54 -2
- metadata +11 -2
@@ -20,6 +20,7 @@ module RelatonBib
|
|
20
20
|
|
21
21
|
# @return [Hash]
|
22
22
|
def item_data(bibitem)
|
23
|
+
ext = bibitem.at "//ext"
|
23
24
|
{
|
24
25
|
id: bibitem[:id]&.empty? ? nil : bibitem[:id],
|
25
26
|
type: bibitem[:type]&.empty? ? nil : bibitem[:type],
|
@@ -49,6 +50,10 @@ module RelatonBib
|
|
49
50
|
keyword: bibitem.xpath("keyword").map(&:text),
|
50
51
|
license: bibitem.xpath("license").map(&:text),
|
51
52
|
validity: fetch_validity(bibitem),
|
53
|
+
doctype: ext&.at("doctype")&.text,
|
54
|
+
editorialgroup: fetch_editorialgroup(ext),
|
55
|
+
ics: fetch_ics(ext),
|
56
|
+
structuredidentifier: fetch_structuredidentifier(ext),
|
52
57
|
}
|
53
58
|
end
|
54
59
|
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize
|
@@ -351,7 +356,7 @@ module RelatonBib
|
|
351
356
|
if lc[:type]
|
352
357
|
LocalityStack.new [locality(lc)]
|
353
358
|
else
|
354
|
-
LocalityStack.new
|
359
|
+
LocalityStack.new(lc.xpath("./locality").map { |l| locality l })
|
355
360
|
end
|
356
361
|
end
|
357
362
|
end
|
@@ -359,7 +364,7 @@ module RelatonBib
|
|
359
364
|
# @param loc [Nokogiri::XML::Element]
|
360
365
|
# @return [RelatonBib::Locality]
|
361
366
|
def locality(loc, klass = Locality)
|
362
|
-
ref_to = (rt = loc.at("./referenceTo"))
|
367
|
+
ref_to = (rt = loc.at("./referenceTo")) && LocalizedString.new(rt.text)
|
363
368
|
klass.new(
|
364
369
|
loc[:type],
|
365
370
|
LocalizedString.new(loc.at("./referenceFrom").text),
|
@@ -391,6 +396,53 @@ module RelatonBib
|
|
391
396
|
language: ident[:language], script: ident[:script]
|
392
397
|
)
|
393
398
|
end
|
399
|
+
|
400
|
+
# @param ext [Nokogiri::XML::Element]
|
401
|
+
# @return [RelatonBib::EditorialGroup, nil]
|
402
|
+
def fetch_editorialgroup(ext)
|
403
|
+
return unless ext && (eg = ext.at "editorialgroup")
|
404
|
+
|
405
|
+
eg = eg.xpath("technical-committee").map do |tc|
|
406
|
+
wg = WorkGroup.new(content: tc.text, number: tc[:number]&.to_i,
|
407
|
+
type: tc[:type])
|
408
|
+
TechnicalCommittee.new wg
|
409
|
+
end
|
410
|
+
EditorialGroup.new eg if eg.any?
|
411
|
+
end
|
412
|
+
|
413
|
+
def fetch_ics(ext)
|
414
|
+
return [] unless ext
|
415
|
+
|
416
|
+
ext.xpath("ics").map do |ics|
|
417
|
+
ICS.new code: ics.at("code").text, text: ics.at("text").text
|
418
|
+
end
|
419
|
+
end
|
420
|
+
|
421
|
+
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
422
|
+
|
423
|
+
# @param ext [Nokogiri::XML::Element]
|
424
|
+
# @return [RelatonBib::StructuredIdentifierCollection]
|
425
|
+
def fetch_structuredidentifier(ext)
|
426
|
+
return unless ext
|
427
|
+
|
428
|
+
sids = ext.xpath("structuredidentifier").map do |si|
|
429
|
+
StructuredIdentifier.new(
|
430
|
+
type: si[:type],
|
431
|
+
agency: si.xpath("agency").map(&:text),
|
432
|
+
class: si.at("class")&.text,
|
433
|
+
docnumber: si.at("docnumber")&.text,
|
434
|
+
partnumber: si.at("partnumber")&.text,
|
435
|
+
edition: si.at("edition")&.text,
|
436
|
+
version: si.at("version")&.text,
|
437
|
+
supplementtype: si.at("supplementtype")&.text,
|
438
|
+
supplementnumber: si.at("supplementnumber")&.text,
|
439
|
+
language: si.at("language")&.text,
|
440
|
+
year: si.at("year")&.text,
|
441
|
+
)
|
442
|
+
end
|
443
|
+
StructuredIdentifierCollection.new sids
|
444
|
+
end
|
445
|
+
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
394
446
|
end
|
395
447
|
end
|
396
448
|
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.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -201,6 +201,10 @@ files:
|
|
201
201
|
- bin/rspec
|
202
202
|
- bin/setup
|
203
203
|
- docs/hash.adoc
|
204
|
+
- grammars/basicdoc.rng
|
205
|
+
- grammars/biblio.rng
|
206
|
+
- grammars/isodoc.rng
|
207
|
+
- grammars/reqt.rng
|
204
208
|
- lib/relaton_bib.rb
|
205
209
|
- lib/relaton_bib/bib_item_locality.rb
|
206
210
|
- lib/relaton_bib/biblio_note.rb
|
@@ -217,22 +221,27 @@ files:
|
|
217
221
|
- lib/relaton_bib/document_relation.rb
|
218
222
|
- lib/relaton_bib/document_relation_collection.rb
|
219
223
|
- lib/relaton_bib/document_status.rb
|
224
|
+
- lib/relaton_bib/editorial_group.rb
|
220
225
|
- lib/relaton_bib/formatted_ref.rb
|
221
226
|
- lib/relaton_bib/formatted_string.rb
|
222
227
|
- lib/relaton_bib/hash_converter.rb
|
223
228
|
- lib/relaton_bib/hit.rb
|
224
229
|
- lib/relaton_bib/hit_collection.rb
|
230
|
+
- lib/relaton_bib/ics.rb
|
225
231
|
- lib/relaton_bib/localized_string.rb
|
226
232
|
- lib/relaton_bib/medium.rb
|
227
233
|
- lib/relaton_bib/organization.rb
|
228
234
|
- lib/relaton_bib/person.rb
|
229
235
|
- lib/relaton_bib/place.rb
|
230
236
|
- lib/relaton_bib/series.rb
|
237
|
+
- lib/relaton_bib/structured_identifier.rb
|
238
|
+
- lib/relaton_bib/technical_committee.rb
|
231
239
|
- lib/relaton_bib/typed_title_string.rb
|
232
240
|
- lib/relaton_bib/typed_uri.rb
|
233
241
|
- lib/relaton_bib/validity.rb
|
234
242
|
- lib/relaton_bib/version.rb
|
235
243
|
- lib/relaton_bib/workers_pool.rb
|
244
|
+
- lib/relaton_bib/workgroup.rb
|
236
245
|
- lib/relaton_bib/xml_parser.rb
|
237
246
|
- relaton-bib.gemspec
|
238
247
|
homepage: https://github.com/relaton/relaton-bib
|