relaton-nist 1.2.0 → 1.2.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/lib/relaton_nist/document_relation.rb +5 -0
- data/lib/relaton_nist/hash_converter.rb +18 -0
- data/lib/relaton_nist/nist_bibliographic_item.rb +1 -1
- data/lib/relaton_nist/nist_bibliography.rb +1 -0
- data/lib/relaton_nist/scrapper.rb +11 -8
- data/lib/relaton_nist/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d852851cf220ab63699584b62e0d5a051ad39eb9b7ef287840cbd782ce67bed9
|
|
4
|
+
data.tar.gz: 25208ad1822a38f658cb9d1a857451f614598b2dddcc969a84c31fd3c204ac1d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8e60c1f19d96a5d289a780ea29cec5830db57ca84c3007d5f0380b0fca6338538d75456bf963fb2f64208105a18b3b08073f642c66b2323fe481fd2d15f578c1
|
|
7
|
+
data.tar.gz: c19983c79a538c1bd0357ffbefc2b3e4450115f505f01b38fbf44e5028e67d8a544e339d2f4e88b5532c4d8ec6e22caa6e12e3b7e592ecf4849f7c34064a5cb3
|
|
@@ -26,6 +26,24 @@ module RelatonNist
|
|
|
26
26
|
|
|
27
27
|
ret[:commentperiod] = CommentPeriod.new ret[:commentperiod]
|
|
28
28
|
end
|
|
29
|
+
|
|
30
|
+
# @param ret [Hash]
|
|
31
|
+
def relations_hash_to_bib(ret)
|
|
32
|
+
super
|
|
33
|
+
return unless ret[:relation]
|
|
34
|
+
|
|
35
|
+
ret[:relation] = ret[:relation].map { |r| DocumentRelation.new r }
|
|
36
|
+
|
|
37
|
+
# ret[:relation] = array(ret[:relation])
|
|
38
|
+
# ret[:relation]&.each do |r|
|
|
39
|
+
# if r[:description]
|
|
40
|
+
# r[:description] = FormattedString.new r[:description]
|
|
41
|
+
# end
|
|
42
|
+
# relation_bibitem_hash_to_bib(r)
|
|
43
|
+
# relation_locality_hash_to_bib(r)
|
|
44
|
+
# relation_source_locality_hash_to_bib(r)
|
|
45
|
+
# end
|
|
46
|
+
end
|
|
29
47
|
end
|
|
30
48
|
end
|
|
31
49
|
end
|
|
@@ -51,7 +51,7 @@ module RelatonNist
|
|
|
51
51
|
# @option abstract [String] :script
|
|
52
52
|
# @option abstract [String] :type
|
|
53
53
|
#
|
|
54
|
-
# @param relation [Array<Hash>]
|
|
54
|
+
# @param relation [Array<Hash, RelatonNist::DocumentRelation>]
|
|
55
55
|
# @option relation [String] :type
|
|
56
56
|
# @option relation [RelatonBib::BibliographicItem] :bibitem
|
|
57
57
|
# @option relation [Array<RelatonBib::BibItemLocality>] :bib_locality
|
|
@@ -235,15 +235,18 @@ module RelatonNist
|
|
|
235
235
|
)
|
|
236
236
|
end
|
|
237
237
|
if contr["surname"]
|
|
238
|
-
affiliation =
|
|
238
|
+
affiliation = []
|
|
239
|
+
affiliation << RelatonBib::Affiliation.new(organization: org) if org
|
|
239
240
|
entity = RelatonBib::Person.new(
|
|
240
|
-
name: full_name(contr, lang, script), affiliation:
|
|
241
|
+
name: full_name(contr, lang, script), affiliation: affiliation,
|
|
241
242
|
)
|
|
242
|
-
|
|
243
|
+
elsif org
|
|
243
244
|
entity = org
|
|
244
245
|
end
|
|
245
|
-
|
|
246
|
-
|
|
246
|
+
if entity
|
|
247
|
+
RelatonBib::ContributionInfo.new entity: entity, role: [type: role]
|
|
248
|
+
end
|
|
249
|
+
end.compact
|
|
247
250
|
end
|
|
248
251
|
|
|
249
252
|
# rubocop:disable Metrics/CyclomaticComplexity
|
|
@@ -373,7 +376,7 @@ module RelatonNist
|
|
|
373
376
|
|
|
374
377
|
# Fetch relations.
|
|
375
378
|
# @param doc [Nokogiri::HTML::Document]
|
|
376
|
-
# @return [Array<
|
|
379
|
+
# @return [Array<RelatonNist::DocumentRelation>]
|
|
377
380
|
def fetch_relations(doc)
|
|
378
381
|
relations = doc.xpath('//span[@id="pub-supersedes-container"]/a').map do |r|
|
|
379
382
|
doc_relation "supersedes", r.text, DOMAIN + r[:href]
|
|
@@ -402,9 +405,9 @@ module RelatonNist
|
|
|
402
405
|
# @param type [String]
|
|
403
406
|
# @param ref [String]
|
|
404
407
|
# @param uri [String]
|
|
405
|
-
# @return [
|
|
408
|
+
# @return [RelatonNist::DocumentRelation]
|
|
406
409
|
def doc_relation(type, ref, uri, lang = "en", script = "Latn")
|
|
407
|
-
|
|
410
|
+
DocumentRelation.new(
|
|
408
411
|
type: type,
|
|
409
412
|
bibitem: RelatonBib::BibliographicItem.new(
|
|
410
413
|
formattedref: RelatonBib::FormattedRef.new(
|
data/lib/relaton_nist/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-nist
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.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-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: debase
|
|
@@ -204,6 +204,7 @@ files:
|
|
|
204
204
|
- grammars/reqt.rng
|
|
205
205
|
- lib/relaton_nist.rb
|
|
206
206
|
- lib/relaton_nist/comment_period.rb
|
|
207
|
+
- lib/relaton_nist/document_relation.rb
|
|
207
208
|
- lib/relaton_nist/document_status.rb
|
|
208
209
|
- lib/relaton_nist/hash_converter.rb
|
|
209
210
|
- lib/relaton_nist/hit.rb
|