relaton-bib 1.20.7 → 2.0.0.pre.alpha.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/.rubocop.yml +1 -1
- data/README.adoc +183 -154
- data/bin/console +1 -1
- data/grammars/basicdoc.rng +1516 -645
- data/grammars/biblio-standoc.rng +100 -20
- data/grammars/biblio.rng +959 -356
- data/grammars/versions.json +10 -10
- data/lib/relaton/bib/hash_parser_v1.rb +711 -0
- data/lib/relaton/bib/item_data.rb +168 -0
- data/lib/relaton/bib/model/address.rb +22 -0
- data/lib/relaton/bib/model/affiliation.rb +16 -0
- data/lib/relaton/bib/model/bibdata.rb +24 -0
- data/lib/relaton/bib/model/bibitem.rb +23 -0
- data/lib/relaton/bib/model/contact.rb +18 -0
- data/lib/relaton/bib/model/contribution_info.rb +16 -0
- data/lib/relaton/bib/model/contributor.rb +71 -0
- data/lib/relaton/bib/model/copyright.rb +27 -0
- data/lib/relaton/bib/model/date.rb +29 -0
- data/lib/relaton/bib/model/depiction.rb +14 -0
- data/lib/relaton/bib/model/docidentifier.rb +33 -0
- data/lib/relaton/bib/model/doctype.rb +14 -0
- data/lib/relaton/bib/model/edition.rb +14 -0
- data/lib/relaton/bib/model/editorial_group.rb +14 -0
- data/lib/relaton/bib/model/ext.rb +29 -0
- data/lib/relaton/bib/model/extent.rb +16 -0
- data/lib/relaton/bib/model/full_name_type.rb +64 -0
- data/lib/relaton/bib/model/fullname.rb +11 -0
- data/lib/relaton/bib/model/ics.rb +14 -0
- data/lib/relaton/bib/model/image.rb +28 -0
- data/lib/relaton/bib/model/item.rb +129 -0
- data/lib/relaton/bib/model/item_base.rb +19 -0
- data/lib/relaton/bib/model/keyword.rb +30 -0
- data/lib/relaton/bib/model/locality.rb +18 -0
- data/lib/relaton/bib/model/locality_stack.rb +14 -0
- data/lib/relaton/bib/model/localized_string.rb +57 -0
- data/lib/relaton/bib/model/localized_string_attrs.rb +24 -0
- data/lib/relaton/bib/model/logo.rb +12 -0
- data/lib/relaton/bib/model/medium.rb +22 -0
- data/lib/relaton/bib/model/note.rb +16 -0
- data/lib/relaton/bib/model/organization.rb +13 -0
- data/lib/relaton/bib/model/organization_type.rb +42 -0
- data/lib/relaton/bib/model/person.rb +36 -0
- data/lib/relaton/bib/model/phone.rb +14 -0
- data/lib/relaton/bib/model/place.rb +33 -0
- data/lib/relaton/bib/model/price.rb +14 -0
- data/lib/relaton/bib/model/relation.rb +43 -0
- data/lib/relaton/bib/model/series.rb +32 -0
- data/lib/relaton/bib/model/size.rb +23 -0
- data/lib/relaton/bib/model/source_locality_stack.rb +14 -0
- data/lib/relaton/bib/model/status.rb +27 -0
- data/lib/relaton/bib/model/structured_identifier.rb +48 -0
- data/lib/relaton/bib/model/subdivision.rb +14 -0
- data/lib/relaton/bib/model/technical_committee.rb +14 -0
- data/lib/relaton/bib/model/title.rb +18 -0
- data/lib/relaton/bib/model/uri.rb +18 -0
- data/lib/relaton/bib/model/validity.rb +16 -0
- data/lib/relaton/bib/model/version.rb +14 -0
- data/lib/relaton/bib/model/workgroup.rb +20 -0
- data/lib/relaton/bib/parser/rfc_address.rb +60 -0
- data/lib/relaton/bib/parser/rfc_contacts.rb +35 -0
- data/lib/relaton/bib/parser/rfc_docidentifier.rb +70 -0
- data/lib/relaton/bib/parser/rfc_organization.rb +31 -0
- data/lib/relaton/bib/parser/rfc_person.rb +42 -0
- data/lib/relaton/bib/parser/rfc_reference.rb +143 -0
- data/lib/relaton/bib/parser/rfc_referencegroup.rb +45 -0
- data/lib/relaton/bib/parser/rfc_shared.rb +23 -0
- data/lib/relaton/bib/renderer/bibtex_builder.rb +348 -0
- data/lib/relaton/bib/renderer/rfc.rb +297 -0
- data/lib/relaton/bib/util.rb +18 -0
- data/lib/relaton/bib/version.rb +5 -0
- data/lib/{relaton_bib.rb → relaton/bib.rb} +47 -36
- data/lib/{relaton_bib → relaton}/bibtex_parser.rb +24 -27
- data/lib/{relaton_bib → relaton}/bibxml_parser.rb +43 -46
- data/lib/{relaton_bib → relaton}/hit.rb +3 -3
- data/lib/{relaton_bib → relaton}/hit_collection.rb +2 -2
- data/lib/{relaton_bib → relaton}/workers_pool.rb +1 -1
- data/lib/{relaton_bib → relaton}/xml_parser.rb +49 -51
- data/relaton-bib.gemspec +8 -8
- metadata +95 -74
- data/lib/relaton_bib/bib_item_locality.rb +0 -175
- data/lib/relaton_bib/biblio_note.rb +0 -72
- data/lib/relaton_bib/biblio_version.rb +0 -46
- data/lib/relaton_bib/bibliographic_date.rb +0 -119
- data/lib/relaton_bib/bibliographic_item.rb +0 -668
- data/lib/relaton_bib/bibliographic_size.rb +0 -103
- data/lib/relaton_bib/classification.rb +0 -40
- data/lib/relaton_bib/config.rb +0 -16
- data/lib/relaton_bib/contribution_info.rb +0 -117
- data/lib/relaton_bib/contributor.rb +0 -277
- data/lib/relaton_bib/copyright_association.rb +0 -79
- data/lib/relaton_bib/document_identifier.rb +0 -118
- data/lib/relaton_bib/document_relation.rb +0 -95
- data/lib/relaton_bib/document_relation_collection.rb +0 -57
- data/lib/relaton_bib/document_status.rb +0 -92
- data/lib/relaton_bib/document_type.rb +0 -52
- data/lib/relaton_bib/edition.rb +0 -55
- data/lib/relaton_bib/editorial_group.rb +0 -41
- data/lib/relaton_bib/extent.rb +0 -39
- data/lib/relaton_bib/forename.rb +0 -65
- data/lib/relaton_bib/formatted_ref.rb +0 -17
- data/lib/relaton_bib/formatted_string.rb +0 -133
- data/lib/relaton_bib/full_name.rb +0 -108
- data/lib/relaton_bib/hash_converter.rb +0 -568
- data/lib/relaton_bib/ics.rb +0 -42
- data/lib/relaton_bib/image.rb +0 -95
- data/lib/relaton_bib/localized_string.rb +0 -149
- data/lib/relaton_bib/medium.rb +0 -76
- data/lib/relaton_bib/organization.rb +0 -165
- data/lib/relaton_bib/person.rb +0 -129
- data/lib/relaton_bib/place.rb +0 -203
- data/lib/relaton_bib/renderer/bibtex_builder.rb +0 -312
- data/lib/relaton_bib/renderer/bibxml.rb +0 -296
- data/lib/relaton_bib/series.rb +0 -119
- data/lib/relaton_bib/structured_identifier.rb +0 -173
- data/lib/relaton_bib/technical_committee.rb +0 -34
- data/lib/relaton_bib/typed_title_string.rb +0 -191
- data/lib/relaton_bib/typed_uri.rb +0 -57
- data/lib/relaton_bib/util.rb +0 -16
- data/lib/relaton_bib/validity.rb +0 -52
- data/lib/relaton_bib/version.rb +0 -3
- data/lib/relaton_bib/workgroup.rb +0 -58
- /data/lib/{relaton_bib → relaton}/deep_dup.rb +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
require "nokogiri"
|
2
2
|
|
3
|
-
module
|
3
|
+
module Relaton
|
4
4
|
class XMLParser
|
5
5
|
class << self
|
6
6
|
#
|
@@ -8,7 +8,7 @@ module RelatonBib
|
|
8
8
|
#
|
9
9
|
# @param [String] xml XML string
|
10
10
|
#
|
11
|
-
# @return [
|
11
|
+
# @return [Relaton::Bib::Item, nil] bibliographic item
|
12
12
|
#
|
13
13
|
def from_xml(xml)
|
14
14
|
doc = Nokogiri::XML(xml)
|
@@ -76,13 +76,13 @@ module RelatonBib
|
|
76
76
|
#
|
77
77
|
# @param [Nokogiri::XML::Elemetn] item bibitem element
|
78
78
|
#
|
79
|
-
# @return [Array<
|
79
|
+
# @return [Array<Relaton::Bib::Item::Version>] versions
|
80
80
|
#
|
81
81
|
def fetch_version(item)
|
82
82
|
item.xpath("./version").map do |v|
|
83
83
|
revision_date = v.at("revision-date")&.text
|
84
84
|
draft = v.at("draft")&.text
|
85
|
-
|
85
|
+
Relaton::Bib::Item::Version.new revision_date, draft
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
@@ -91,7 +91,7 @@ module RelatonBib
|
|
91
91
|
#
|
92
92
|
# @param [Nokogiri::XML::Elemetn] item bibitem element
|
93
93
|
#
|
94
|
-
# @return [
|
94
|
+
# @return [Relaton::Bib::Edition, nil] edition
|
95
95
|
#
|
96
96
|
def fetch_edition(item)
|
97
97
|
edt = item.at("./edition")
|
@@ -105,7 +105,7 @@ module RelatonBib
|
|
105
105
|
#
|
106
106
|
# @param [Nokogiri::XML::Element] item bibitem element
|
107
107
|
#
|
108
|
-
# @return [Array<
|
108
|
+
# @return [Array<Relaton::Bib::Place>] array of places
|
109
109
|
#
|
110
110
|
def fetch_place(item)
|
111
111
|
item.xpath("./place").map do |pl|
|
@@ -124,7 +124,7 @@ module RelatonBib
|
|
124
124
|
# @param [Nokogiri::XML::Element] place place element
|
125
125
|
# @param [String] node name of the node to parse
|
126
126
|
#
|
127
|
-
# @return [Array<
|
127
|
+
# @return [Array<Relaton::Bib::Place::RegionType>] <description>
|
128
128
|
#
|
129
129
|
def create_region_country(place, node = "region")
|
130
130
|
place.xpath("./#{node}").map do |r|
|
@@ -176,7 +176,7 @@ module RelatonBib
|
|
176
176
|
#
|
177
177
|
# @param [Nokogiri::XML::Element] item bibitem element
|
178
178
|
#
|
179
|
-
# @return [Array<
|
179
|
+
# @return [Array<Relaton::Bib::Series>] series
|
180
180
|
#
|
181
181
|
def fetch_series(item) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/AbcSize,Metrics/MethodLength,Metrics/PerceivedComplexity
|
182
182
|
item.xpath("./series").reduce([]) do |mem, sr|
|
@@ -201,7 +201,7 @@ module RelatonBib
|
|
201
201
|
#
|
202
202
|
# @param [Nokogiri::XML::Element] item item element
|
203
203
|
#
|
204
|
-
# @return [
|
204
|
+
# @return [Relaton::Bib::Medium, nil] medium
|
205
205
|
#
|
206
206
|
def fetch_medium(item) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/AbcSize,Metrics/PerceivedComplexity
|
207
207
|
medium = item.at("./medium")
|
@@ -232,7 +232,7 @@ module RelatonBib
|
|
232
232
|
#
|
233
233
|
# @param [Nokogiri::XML::Element] item item element
|
234
234
|
#
|
235
|
-
# @return [
|
235
|
+
# @return [Relaton::Bib::BibliographicSize, nil] size
|
236
236
|
#
|
237
237
|
def fetch_size(item)
|
238
238
|
size = item.xpath("./size/value").map do |sz|
|
@@ -246,7 +246,7 @@ module RelatonBib
|
|
246
246
|
#
|
247
247
|
# @param [Nokogiri::XML::Element] item bibitem element
|
248
248
|
#
|
249
|
-
# @return [Array<
|
249
|
+
# @return [Array<Relaton::Bib::Classification>] classifications
|
250
250
|
#
|
251
251
|
def fetch_classification(item)
|
252
252
|
item.xpath("classification").map do |cls|
|
@@ -259,7 +259,7 @@ module RelatonBib
|
|
259
259
|
#
|
260
260
|
# @param [Nokogiri::XML::Element] item bibitem element
|
261
261
|
#
|
262
|
-
# @return [
|
262
|
+
# @return [Relaton::Bib::Validity, nil] validity
|
263
263
|
#
|
264
264
|
def fetch_validity(item)
|
265
265
|
vl = item.at("./validity")
|
@@ -286,7 +286,7 @@ module RelatonBib
|
|
286
286
|
end
|
287
287
|
|
288
288
|
# @param item [Nokogiri::XML::Element]
|
289
|
-
# @return [Array<
|
289
|
+
# @return [Array<Relaton::Bib::Docidentifier>]
|
290
290
|
def fetch_docid(item)
|
291
291
|
item.xpath("./docidentifier").map do |id|
|
292
292
|
args = id.to_h.transform_keys(&:to_sym)
|
@@ -301,27 +301,27 @@ module RelatonBib
|
|
301
301
|
end
|
302
302
|
|
303
303
|
# @param item [Nokogiri::XML::Element]
|
304
|
-
# @return [
|
304
|
+
# @return [Relaton::Bib::TitleCollection]
|
305
305
|
def fetch_titles(item)
|
306
306
|
ttl = item.xpath("./title").map { |t| ttitle t }
|
307
|
-
|
307
|
+
TitleCollection.new ttl
|
308
308
|
end
|
309
309
|
|
310
310
|
# @param title [Nokogiri::XML::Element]
|
311
|
-
# @return [
|
311
|
+
# @return [Relaton::Bib::Title]
|
312
312
|
def ttitle(title)
|
313
313
|
return unless title
|
314
314
|
|
315
315
|
content = variants(title)
|
316
316
|
content = title.children.map { |n| n.text? ? n.content : n.to_xml }.join unless content.any?
|
317
|
-
|
317
|
+
Typed.new(
|
318
318
|
type: title[:type], content: content, language: title[:language],
|
319
319
|
script: title[:script], format: title[:format]
|
320
320
|
)
|
321
321
|
end
|
322
322
|
|
323
323
|
# @param title [Nokogiri::XML::Element]
|
324
|
-
# @return [Array<
|
324
|
+
# @return [Array<Relaton::Bib::LocalizedString>]
|
325
325
|
def variants(elm)
|
326
326
|
elm.xpath("variant").map { |v| localized_string v }
|
327
327
|
end
|
@@ -331,7 +331,7 @@ module RelatonBib
|
|
331
331
|
#
|
332
332
|
# @param [Nokogiri::XML::Element] item XML element
|
333
333
|
#
|
334
|
-
# @return [
|
334
|
+
# @return [Relaton::Bib::DocumentStatus, nil] status
|
335
335
|
#
|
336
336
|
def fetch_status(item)
|
337
337
|
status = item.at("./status")
|
@@ -346,7 +346,7 @@ module RelatonBib
|
|
346
346
|
end
|
347
347
|
|
348
348
|
# @param node [Nokogiri::XML::Elemen]
|
349
|
-
# @return [
|
349
|
+
# @return [Relaton::Bib::DocumentStatus::Stage]
|
350
350
|
def stage(elm)
|
351
351
|
return unless elm
|
352
352
|
|
@@ -355,15 +355,15 @@ module RelatonBib
|
|
355
355
|
end
|
356
356
|
|
357
357
|
# @param node [Nokogiri::XML::Elemen]
|
358
|
-
# @return [Array<
|
358
|
+
# @return [Array<Relaton::Bib::Bdate>]
|
359
359
|
def fetch_dates(item) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
360
360
|
item.xpath("./date").each_with_object([]) do |d, a|
|
361
361
|
type = d[:type].to_s.empty? ? "published" : d[:type]
|
362
362
|
if (on = d.at("on"))
|
363
|
-
a <<
|
363
|
+
a << Relaton::Bib::Bdate.new(type: type, on: on.text,
|
364
364
|
to: d.at("to")&.text)
|
365
365
|
elsif (from = d.at("from"))
|
366
|
-
a <<
|
366
|
+
a << Relaton::Bib::Bdate.new(type: type, from: from.text,
|
367
367
|
to: d.at("to")&.text)
|
368
368
|
end
|
369
369
|
end
|
@@ -374,7 +374,7 @@ module RelatonBib
|
|
374
374
|
#
|
375
375
|
# @param [Nokogiri::XML::Element] org XML element
|
376
376
|
#
|
377
|
-
# @return [
|
377
|
+
# @return [Relaton::Bib::Organization, nil] organization
|
378
378
|
#
|
379
379
|
def get_org(org) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
380
380
|
return unless org
|
@@ -406,7 +406,7 @@ module RelatonBib
|
|
406
406
|
#
|
407
407
|
# @param [Nokogiri::XML::Element] person XML element
|
408
408
|
#
|
409
|
-
# @return [
|
409
|
+
# @return [Relaton::Bib::Person, nil] person
|
410
410
|
#
|
411
411
|
def get_person(person) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
412
412
|
return unless person
|
@@ -415,7 +415,7 @@ module RelatonBib
|
|
415
415
|
|
416
416
|
contact = parse_contact person
|
417
417
|
identifier = person.xpath("./identifier").map do |pi|
|
418
|
-
|
418
|
+
Person::Identifier.new type: pi[:type], content: pi.text
|
419
419
|
end
|
420
420
|
|
421
421
|
Person.new(
|
@@ -460,7 +460,7 @@ module RelatonBib
|
|
460
460
|
#
|
461
461
|
# @param [Nokogiri::XML::Element] contrib contributor element
|
462
462
|
#
|
463
|
-
# @return [Array<
|
463
|
+
# @return [Array<Relaton::Bib::Address, Relaton::Bib::Contact>] contacts
|
464
464
|
#
|
465
465
|
def parse_contact(contrib)
|
466
466
|
contrib.xpath("./address|./phone|./email|./uri").map do |c|
|
@@ -473,7 +473,7 @@ module RelatonBib
|
|
473
473
|
#
|
474
474
|
# @param [Nokogiri::XML::Element] contact contact element
|
475
475
|
#
|
476
|
-
# @return [
|
476
|
+
# @return [Relaton::Bib::Address] address
|
477
477
|
#
|
478
478
|
def parse_address(contact) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
479
479
|
return unless contact.name == "address"
|
@@ -493,7 +493,7 @@ module RelatonBib
|
|
493
493
|
#
|
494
494
|
# @param [Nokogiri::XML::Element] name person name element
|
495
495
|
#
|
496
|
-
# @return [
|
496
|
+
# @return [Relaton::Bib::LocalizedString, nil] initials
|
497
497
|
#
|
498
498
|
def parse_initials(name)
|
499
499
|
localized_string name.at("./formatted-initials")
|
@@ -504,7 +504,7 @@ module RelatonBib
|
|
504
504
|
#
|
505
505
|
# @param [Nokogiri::XML::Element] name person name element
|
506
506
|
#
|
507
|
-
# @return [Array<
|
507
|
+
# @return [Array<Relaton::Bib::Forename>] forenames
|
508
508
|
#
|
509
509
|
def parse_forename(name)
|
510
510
|
name.xpath("./forename").map do |np|
|
@@ -520,14 +520,14 @@ module RelatonBib
|
|
520
520
|
# @param [Nokogiri::XML::Element] name person name element
|
521
521
|
# @param [String] part name part
|
522
522
|
#
|
523
|
-
# @return [Array<
|
523
|
+
# @return [Array<Relaton::Bib::LocalizedString>] name parts
|
524
524
|
#
|
525
525
|
def name_part(name, part)
|
526
526
|
name.xpath("./#{part}").map { |np| localized_string np }
|
527
527
|
end
|
528
528
|
|
529
529
|
# @param item [Nokogiri::XML::Element]
|
530
|
-
# @return [Array<
|
530
|
+
# @return [Array<Relaton::Bib::ContributionInfo>]
|
531
531
|
def fetch_contributors(item)
|
532
532
|
item.xpath("./contributor").map { |c| fetch_contribution_info c }
|
533
533
|
end
|
@@ -541,7 +541,7 @@ module RelatonBib
|
|
541
541
|
end
|
542
542
|
|
543
543
|
# @param item [Nokogiri::XML::Element]
|
544
|
-
# @return [Array<
|
544
|
+
# @return [Array<Relaton::Bib::FormattedString>]
|
545
545
|
def fetch_abstract(item)
|
546
546
|
item.xpath("./abstract").map do |a|
|
547
547
|
c = a.children.to_xml(encoding: "utf-8").strip
|
@@ -551,7 +551,7 @@ module RelatonBib
|
|
551
551
|
end
|
552
552
|
|
553
553
|
# @param item [Nokogiri::XML::Element]
|
554
|
-
# @return [Array<
|
554
|
+
# @return [Array<Relaton::Bib::CopyrightAssociation>]
|
555
555
|
def fetch_copyright(item)
|
556
556
|
item.xpath("./copyright").map do |cp|
|
557
557
|
owner = cp.xpath("owner").map { |o| fetch_contribution_info o }
|
@@ -563,18 +563,17 @@ module RelatonBib
|
|
563
563
|
end
|
564
564
|
|
565
565
|
# @param item [Nokogiri::XML::Element]
|
566
|
-
# @return [Arra<
|
566
|
+
# @return [Arra<Relaton::Bib::Bsource>]
|
567
567
|
def fetch_link(item)
|
568
568
|
item.xpath("./uri").map do |l|
|
569
|
-
|
569
|
+
Bsource.new(type: l[:type], content: l.text, language: l[:language],
|
570
570
|
script: l[:script])
|
571
571
|
end
|
572
572
|
end
|
573
573
|
|
574
574
|
# @param item [Nokogiri::XML::Element]
|
575
|
-
# @param klass [
|
576
|
-
#
|
577
|
-
# @return [Array<RelatonBib::DocumentRelation>]
|
575
|
+
# @param klass [Relaton::Bib::DocumentRelation.class, RelatonNist::DocumentRelation.class]
|
576
|
+
# @return [Array<Relaton::Bib::DocumentRelation>]
|
578
577
|
def fetch_relations(item, klass = DocumentRelation)
|
579
578
|
item.xpath("./relation").map do |rel|
|
580
579
|
klass.new(
|
@@ -588,7 +587,7 @@ module RelatonBib
|
|
588
587
|
end
|
589
588
|
|
590
589
|
# @param rel [Nokogiri::XML::Element]
|
591
|
-
# @return [
|
590
|
+
# @return [Relaton::Bib::FormattedString, nil]
|
592
591
|
def relation_description(rel)
|
593
592
|
d = rel.at "./description"
|
594
593
|
return unless d
|
@@ -602,10 +601,10 @@ module RelatonBib
|
|
602
601
|
#
|
603
602
|
# @param item_hash [Hash] bibliographic item hash
|
604
603
|
#
|
605
|
-
# @return [
|
604
|
+
# @return [Relaton::Bib::Item] bibliographic item
|
606
605
|
#
|
607
606
|
def bib_item(item_hash)
|
608
|
-
|
607
|
+
Item.new(**item_hash)
|
609
608
|
end
|
610
609
|
|
611
610
|
#
|
@@ -613,7 +612,7 @@ module RelatonBib
|
|
613
612
|
#
|
614
613
|
# @param rel [Nokogiri::XML::Element] relation element
|
615
614
|
#
|
616
|
-
# @return [Array<
|
615
|
+
# @return [Array<Relaton::Bib::Locality, Relaton::Bib::LocalityStack>] localities
|
617
616
|
#
|
618
617
|
def localities(rel)
|
619
618
|
rel.xpath("./locality|./localityStack").map do |lc|
|
@@ -629,9 +628,9 @@ module RelatonBib
|
|
629
628
|
# Create Locality object from Nokogiri::XML::Element
|
630
629
|
#
|
631
630
|
# @param loc [Nokogiri::XML::Element]
|
632
|
-
# @param klass [
|
631
|
+
# @param klass [Relaton::Bib::Locality, Relaton::Bib::LocalityStack]
|
633
632
|
#
|
634
|
-
# @return [
|
633
|
+
# @return [Relaton::Bib::Locality]
|
635
634
|
def locality(loc, klass = Locality)
|
636
635
|
klass.new(
|
637
636
|
loc[:type],
|
@@ -641,8 +640,7 @@ module RelatonBib
|
|
641
640
|
end
|
642
641
|
|
643
642
|
# @param rel [Nokogiri::XML::Element]
|
644
|
-
# @return [Array<
|
645
|
-
# RelatonBib::SourceLocalityStack>]
|
643
|
+
# @return [Array<Relaton::Bib::SourceLocality, Relaton::Bib::SourceLocalityStack>]
|
646
644
|
def source_localities(rel)
|
647
645
|
rel.xpath("./sourceLocality|./sourceLocalityStack").map do |loc|
|
648
646
|
if loc.name == "sourceLocality"
|
@@ -657,19 +655,19 @@ module RelatonBib
|
|
657
655
|
end
|
658
656
|
|
659
657
|
# @param item [Nokogiri::XML::Element]
|
660
|
-
# @return [
|
658
|
+
# @return [Relaton::Bib::Formattedref, nil]
|
661
659
|
def fref(item)
|
662
660
|
ident = item&.at("./formattedref")
|
663
661
|
return unless ident
|
664
662
|
|
665
|
-
|
663
|
+
Formattedref.new(
|
666
664
|
content: ident.children.to_s, format: ident[:format],
|
667
665
|
language: ident[:language], script: ident[:script]
|
668
666
|
)
|
669
667
|
end
|
670
668
|
|
671
669
|
# @param ext [Nokogiri::XML::Element]
|
672
|
-
# @return [
|
670
|
+
# @return [Relaton::Bib::EditorialGroup, nil]
|
673
671
|
def fetch_editorialgroup(ext)
|
674
672
|
return unless ext && (eg = ext.at "editorialgroup")
|
675
673
|
|
@@ -692,7 +690,7 @@ module RelatonBib
|
|
692
690
|
end
|
693
691
|
|
694
692
|
# @param ext [Nokogiri::XML::Element]
|
695
|
-
# @return [
|
693
|
+
# @return [Relaton::Bib::StructuredIdentifierCollection]
|
696
694
|
def fetch_structuredidentifier(ext) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
697
695
|
return unless ext
|
698
696
|
|
data/relaton-bib.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
lib = File.expand_path("lib", __dir__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require "
|
3
|
+
require "relaton/bib/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "relaton-bib"
|
7
|
-
spec.version =
|
7
|
+
spec.version = Relaton::Bib::VERSION
|
8
8
|
spec.authors = ["Ribose Inc."]
|
9
9
|
spec.email = ["open.source@ribose.com"]
|
10
10
|
|
11
|
-
spec.summary = "
|
12
|
-
spec.description = "
|
11
|
+
spec.summary = "Relaton::Bib: Ruby XMLDOC impementation."
|
12
|
+
spec.description = "Relaton::Bib: Ruby XMLDOC impementation."
|
13
13
|
spec.homepage = "https://github.com/relaton/relaton-bib"
|
14
14
|
spec.license = "BSD-2-Clause"
|
15
15
|
|
@@ -21,12 +21,12 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.bindir = "exe"
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ["lib"]
|
24
|
-
spec.required_ruby_version = Gem::Requirement.new(">=
|
24
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
|
25
25
|
|
26
|
-
spec.add_dependency "addressable"
|
27
26
|
spec.add_dependency "bibtex-ruby"
|
28
|
-
spec.add_dependency "htmlentities"
|
29
27
|
spec.add_dependency "iso639"
|
30
|
-
spec.add_dependency "
|
28
|
+
spec.add_dependency "lutaml-model", "~> 0.7"
|
29
|
+
spec.add_dependency "nokogiri", "~> 1.16.0"
|
31
30
|
spec.add_dependency "relaton-logger", "~> 0.2.0"
|
31
|
+
spec.add_dependency "rfcxml", "~> 0.2.1"
|
32
32
|
end
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-bib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0.pre.alpha.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: 2025-
|
11
|
+
date: 2025-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: bibtex-ruby
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: iso639
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -39,62 +39,62 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: lutaml-model
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
47
|
+
version: '0.7'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
54
|
+
version: '0.7'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: nokogiri
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 1.16.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 1.16.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: relaton-logger
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 0.2.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 0.2.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rfcxml
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.2.
|
89
|
+
version: 0.2.1
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.2.
|
97
|
-
description: '
|
96
|
+
version: 0.2.1
|
97
|
+
description: 'Relaton::Bib: Ruby XMLDOC impementation.'
|
98
98
|
email:
|
99
99
|
- open.source@ribose.com
|
100
100
|
executables: []
|
@@ -122,56 +122,77 @@ files:
|
|
122
122
|
- grammars/biblio-standoc.rng
|
123
123
|
- grammars/biblio.rng
|
124
124
|
- grammars/versions.json
|
125
|
-
- lib/
|
126
|
-
- lib/
|
127
|
-
- lib/
|
128
|
-
- lib/
|
129
|
-
- lib/
|
130
|
-
- lib/
|
131
|
-
- lib/
|
132
|
-
- lib/
|
133
|
-
- lib/
|
134
|
-
- lib/
|
135
|
-
- lib/
|
136
|
-
- lib/
|
137
|
-
- lib/
|
138
|
-
- lib/
|
139
|
-
- lib/
|
140
|
-
- lib/
|
141
|
-
- lib/
|
142
|
-
- lib/
|
143
|
-
- lib/
|
144
|
-
- lib/
|
145
|
-
- lib/
|
146
|
-
- lib/
|
147
|
-
- lib/
|
148
|
-
- lib/
|
149
|
-
- lib/
|
150
|
-
- lib/
|
151
|
-
- lib/
|
152
|
-
- lib/
|
153
|
-
- lib/
|
154
|
-
- lib/
|
155
|
-
- lib/
|
156
|
-
- lib/
|
157
|
-
- lib/
|
158
|
-
- lib/
|
159
|
-
- lib/
|
160
|
-
- lib/
|
161
|
-
- lib/
|
162
|
-
- lib/
|
163
|
-
- lib/
|
164
|
-
- lib/
|
165
|
-
- lib/
|
166
|
-
- lib/
|
167
|
-
- lib/
|
168
|
-
- lib/
|
169
|
-
- lib/
|
170
|
-
- lib/
|
171
|
-
- lib/
|
172
|
-
- lib/
|
173
|
-
- lib/
|
174
|
-
- lib/
|
125
|
+
- lib/relaton/bib.rb
|
126
|
+
- lib/relaton/bib/hash_parser_v1.rb
|
127
|
+
- lib/relaton/bib/item_data.rb
|
128
|
+
- lib/relaton/bib/model/address.rb
|
129
|
+
- lib/relaton/bib/model/affiliation.rb
|
130
|
+
- lib/relaton/bib/model/bibdata.rb
|
131
|
+
- lib/relaton/bib/model/bibitem.rb
|
132
|
+
- lib/relaton/bib/model/contact.rb
|
133
|
+
- lib/relaton/bib/model/contribution_info.rb
|
134
|
+
- lib/relaton/bib/model/contributor.rb
|
135
|
+
- lib/relaton/bib/model/copyright.rb
|
136
|
+
- lib/relaton/bib/model/date.rb
|
137
|
+
- lib/relaton/bib/model/depiction.rb
|
138
|
+
- lib/relaton/bib/model/docidentifier.rb
|
139
|
+
- lib/relaton/bib/model/doctype.rb
|
140
|
+
- lib/relaton/bib/model/edition.rb
|
141
|
+
- lib/relaton/bib/model/editorial_group.rb
|
142
|
+
- lib/relaton/bib/model/ext.rb
|
143
|
+
- lib/relaton/bib/model/extent.rb
|
144
|
+
- lib/relaton/bib/model/full_name_type.rb
|
145
|
+
- lib/relaton/bib/model/fullname.rb
|
146
|
+
- lib/relaton/bib/model/ics.rb
|
147
|
+
- lib/relaton/bib/model/image.rb
|
148
|
+
- lib/relaton/bib/model/item.rb
|
149
|
+
- lib/relaton/bib/model/item_base.rb
|
150
|
+
- lib/relaton/bib/model/keyword.rb
|
151
|
+
- lib/relaton/bib/model/locality.rb
|
152
|
+
- lib/relaton/bib/model/locality_stack.rb
|
153
|
+
- lib/relaton/bib/model/localized_string.rb
|
154
|
+
- lib/relaton/bib/model/localized_string_attrs.rb
|
155
|
+
- lib/relaton/bib/model/logo.rb
|
156
|
+
- lib/relaton/bib/model/medium.rb
|
157
|
+
- lib/relaton/bib/model/note.rb
|
158
|
+
- lib/relaton/bib/model/organization.rb
|
159
|
+
- lib/relaton/bib/model/organization_type.rb
|
160
|
+
- lib/relaton/bib/model/person.rb
|
161
|
+
- lib/relaton/bib/model/phone.rb
|
162
|
+
- lib/relaton/bib/model/place.rb
|
163
|
+
- lib/relaton/bib/model/price.rb
|
164
|
+
- lib/relaton/bib/model/relation.rb
|
165
|
+
- lib/relaton/bib/model/series.rb
|
166
|
+
- lib/relaton/bib/model/size.rb
|
167
|
+
- lib/relaton/bib/model/source_locality_stack.rb
|
168
|
+
- lib/relaton/bib/model/status.rb
|
169
|
+
- lib/relaton/bib/model/structured_identifier.rb
|
170
|
+
- lib/relaton/bib/model/subdivision.rb
|
171
|
+
- lib/relaton/bib/model/technical_committee.rb
|
172
|
+
- lib/relaton/bib/model/title.rb
|
173
|
+
- lib/relaton/bib/model/uri.rb
|
174
|
+
- lib/relaton/bib/model/validity.rb
|
175
|
+
- lib/relaton/bib/model/version.rb
|
176
|
+
- lib/relaton/bib/model/workgroup.rb
|
177
|
+
- lib/relaton/bib/parser/rfc_address.rb
|
178
|
+
- lib/relaton/bib/parser/rfc_contacts.rb
|
179
|
+
- lib/relaton/bib/parser/rfc_docidentifier.rb
|
180
|
+
- lib/relaton/bib/parser/rfc_organization.rb
|
181
|
+
- lib/relaton/bib/parser/rfc_person.rb
|
182
|
+
- lib/relaton/bib/parser/rfc_reference.rb
|
183
|
+
- lib/relaton/bib/parser/rfc_referencegroup.rb
|
184
|
+
- lib/relaton/bib/parser/rfc_shared.rb
|
185
|
+
- lib/relaton/bib/renderer/bibtex_builder.rb
|
186
|
+
- lib/relaton/bib/renderer/rfc.rb
|
187
|
+
- lib/relaton/bib/util.rb
|
188
|
+
- lib/relaton/bib/version.rb
|
189
|
+
- lib/relaton/bibtex_parser.rb
|
190
|
+
- lib/relaton/bibxml_parser.rb
|
191
|
+
- lib/relaton/deep_dup.rb
|
192
|
+
- lib/relaton/hit.rb
|
193
|
+
- lib/relaton/hit_collection.rb
|
194
|
+
- lib/relaton/workers_pool.rb
|
195
|
+
- lib/relaton/xml_parser.rb
|
175
196
|
- relaton-bib.gemspec
|
176
197
|
homepage: https://github.com/relaton/relaton-bib
|
177
198
|
licenses:
|
@@ -185,15 +206,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
185
206
|
requirements:
|
186
207
|
- - ">="
|
187
208
|
- !ruby/object:Gem::Version
|
188
|
-
version:
|
209
|
+
version: 3.1.0
|
189
210
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
211
|
requirements:
|
191
212
|
- - ">="
|
192
213
|
- !ruby/object:Gem::Version
|
193
214
|
version: '0'
|
194
215
|
requirements: []
|
195
|
-
rubygems_version: 3.5.
|
216
|
+
rubygems_version: 3.5.11
|
196
217
|
signing_key:
|
197
218
|
specification_version: 4
|
198
|
-
summary: '
|
219
|
+
summary: 'Relaton::Bib: Ruby XMLDOC impementation.'
|
199
220
|
test_files: []
|