relaton-un 1.8.0 → 1.9.0
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/.github/workflows/rake.yml +1 -11
- data/.rubocop.yml +1 -1
- data/grammars/biblio.rng +1 -0
- data/grammars/isodoc.rng +72 -10
- data/grammars/un.rng +3 -0
- data/lib/relaton_un/hit.rb +5 -5
- data/lib/relaton_un/processor.rb +1 -1
- data/lib/relaton_un/un_bibliography.rb +3 -3
- data/lib/relaton_un/version.rb +1 -1
- data/lib/relaton_un/xml_parser.rb +3 -3
- data/relaton_un.gemspec +2 -4
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b64d7b0f28b07e64887e9364f5f5e6ac208b56e41b98b4510bf9d390d196158
|
4
|
+
data.tar.gz: a64346fb10bd24bfa6b4ca63a1e5fc6c34e696b9a76ed79bb162eb599a3cf8a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3733280407058b932f89d5bf7bafd4bd00eaa3669e5d87cc7eab54f0cc0b1e16a412cb5b0d2e20777f2cfb40b6c98ddee3ac63b7174ce28892025cea80693bc9
|
7
|
+
data.tar.gz: 56d9ec70ddda0db1f8849877207cbd82d27bca6011f4916326d5ce456a86385c76ba6974c97b5a34ad8c278dc5afeb1c9a5488120b742c4eccae4af1164038fa
|
data/.github/workflows/rake.yml
CHANGED
@@ -16,19 +16,9 @@ jobs:
|
|
16
16
|
strategy:
|
17
17
|
fail-fast: false
|
18
18
|
matrix:
|
19
|
-
ruby: [ '
|
19
|
+
ruby: [ '3.0', '2.7', '2.6', '2.5' ]
|
20
20
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
21
21
|
experimental: [ false ]
|
22
|
-
include:
|
23
|
-
- ruby: '3.0'
|
24
|
-
os: 'ubuntu-latest'
|
25
|
-
experimental: true
|
26
|
-
- ruby: '3.0'
|
27
|
-
os: 'windows-latest'
|
28
|
-
experimental: true
|
29
|
-
- ruby: '3.0'
|
30
|
-
os: 'macos-latest'
|
31
|
-
experimental: true
|
32
22
|
steps:
|
33
23
|
- uses: actions/checkout@v2
|
34
24
|
with:
|
data/.rubocop.yml
CHANGED
data/grammars/biblio.rng
CHANGED
data/grammars/isodoc.rng
CHANGED
@@ -45,6 +45,11 @@
|
|
45
45
|
<optional>
|
46
46
|
<attribute name="alt"/>
|
47
47
|
</optional>
|
48
|
+
<optional>
|
49
|
+
<attribute name="updatetype">
|
50
|
+
<data type="boolean"/>
|
51
|
+
</attribute>
|
52
|
+
</optional>
|
48
53
|
<text/>
|
49
54
|
</element>
|
50
55
|
</define>
|
@@ -199,6 +204,18 @@
|
|
199
204
|
</zeroOrMore>
|
200
205
|
</element>
|
201
206
|
</define>
|
207
|
+
<define name="dt">
|
208
|
+
<element name="dt">
|
209
|
+
<optional>
|
210
|
+
<attribute name="id">
|
211
|
+
<data type="ID"/>
|
212
|
+
</attribute>
|
213
|
+
</optional>
|
214
|
+
<zeroOrMore>
|
215
|
+
<ref name="TextElement"/>
|
216
|
+
</zeroOrMore>
|
217
|
+
</element>
|
218
|
+
</define>
|
202
219
|
<define name="example">
|
203
220
|
<element name="example">
|
204
221
|
<attribute name="id">
|
@@ -543,6 +560,9 @@
|
|
543
560
|
</define>
|
544
561
|
<define name="BibDataExtensionType">
|
545
562
|
<ref name="doctype"/>
|
563
|
+
<optional>
|
564
|
+
<ref name="docsubtype"/>
|
565
|
+
</optional>
|
546
566
|
<optional>
|
547
567
|
<ref name="editorialgroup"/>
|
548
568
|
</optional>
|
@@ -890,6 +910,14 @@
|
|
890
910
|
</define>
|
891
911
|
</include>
|
892
912
|
<!-- end overrides -->
|
913
|
+
<define name="docsubtype">
|
914
|
+
<element name="subdoctype">
|
915
|
+
<ref name="DocumentSubtype"/>
|
916
|
+
</element>
|
917
|
+
</define>
|
918
|
+
<define name="DocumentSubtype">
|
919
|
+
<text/>
|
920
|
+
</define>
|
893
921
|
<define name="colgroup">
|
894
922
|
<element name="colgroup">
|
895
923
|
<oneOrMore>
|
@@ -939,7 +967,34 @@
|
|
939
967
|
<define name="concept">
|
940
968
|
<element name="concept">
|
941
969
|
<optional>
|
942
|
-
<attribute name="
|
970
|
+
<attribute name="ital">
|
971
|
+
<data type="boolean"/>
|
972
|
+
</attribute>
|
973
|
+
</optional>
|
974
|
+
<optional>
|
975
|
+
<attribute name="ref">
|
976
|
+
<data type="boolean"/>
|
977
|
+
</attribute>
|
978
|
+
</optional>
|
979
|
+
<optional>
|
980
|
+
<element name="refterm">
|
981
|
+
<zeroOrMore>
|
982
|
+
<choice>
|
983
|
+
<ref name="PureTextElement"/>
|
984
|
+
<ref name="stem"/>
|
985
|
+
</choice>
|
986
|
+
</zeroOrMore>
|
987
|
+
</element>
|
988
|
+
</optional>
|
989
|
+
<optional>
|
990
|
+
<element name="renderterm">
|
991
|
+
<zeroOrMore>
|
992
|
+
<choice>
|
993
|
+
<ref name="PureTextElement"/>
|
994
|
+
<ref name="stem"/>
|
995
|
+
</choice>
|
996
|
+
</zeroOrMore>
|
997
|
+
</element>
|
943
998
|
</optional>
|
944
999
|
<choice>
|
945
1000
|
<ref name="eref"/>
|
@@ -965,6 +1020,9 @@
|
|
965
1020
|
</attribute>
|
966
1021
|
<attribute name="name"/>
|
967
1022
|
<attribute name="action"/>
|
1023
|
+
<optional>
|
1024
|
+
<attribute name="class"/>
|
1025
|
+
</optional>
|
968
1026
|
<zeroOrMore>
|
969
1027
|
<choice>
|
970
1028
|
<ref name="TextElement"/>
|
@@ -1191,13 +1249,17 @@
|
|
1191
1249
|
</define>
|
1192
1250
|
<define name="IsoWorkgroup">
|
1193
1251
|
<optional>
|
1194
|
-
<attribute name="number"
|
1195
|
-
<data type="int"/>
|
1196
|
-
</attribute>
|
1252
|
+
<attribute name="number"/>
|
1197
1253
|
</optional>
|
1198
1254
|
<optional>
|
1199
1255
|
<attribute name="type"/>
|
1200
1256
|
</optional>
|
1257
|
+
<optional>
|
1258
|
+
<attribute name="identifier"/>
|
1259
|
+
</optional>
|
1260
|
+
<optional>
|
1261
|
+
<attribute name="prefix"/>
|
1262
|
+
</optional>
|
1201
1263
|
<text/>
|
1202
1264
|
</define>
|
1203
1265
|
<define name="ics">
|
@@ -1459,26 +1521,26 @@
|
|
1459
1521
|
<optional>
|
1460
1522
|
<ref name="section-title"/>
|
1461
1523
|
</optional>
|
1462
|
-
<
|
1524
|
+
<choice>
|
1463
1525
|
<choice>
|
1464
1526
|
<group>
|
1465
|
-
<
|
1527
|
+
<oneOrMore>
|
1466
1528
|
<ref name="BasicBlock"/>
|
1467
|
-
</
|
1529
|
+
</oneOrMore>
|
1468
1530
|
<zeroOrMore>
|
1469
1531
|
<ref name="note"/>
|
1470
1532
|
</zeroOrMore>
|
1471
1533
|
</group>
|
1472
1534
|
<ref name="amend"/>
|
1473
1535
|
</choice>
|
1474
|
-
<
|
1536
|
+
<oneOrMore>
|
1475
1537
|
<choice>
|
1476
1538
|
<ref name="clause-subsection"/>
|
1477
1539
|
<ref name="terms"/>
|
1478
1540
|
<ref name="definitions"/>
|
1479
1541
|
</choice>
|
1480
|
-
</
|
1481
|
-
</
|
1542
|
+
</oneOrMore>
|
1543
|
+
</choice>
|
1482
1544
|
</define>
|
1483
1545
|
<define name="Annex-Section">
|
1484
1546
|
<optional>
|
data/grammars/un.rng
CHANGED
data/lib/relaton_un/hit.rb
CHANGED
@@ -75,7 +75,7 @@ module RelatonUn
|
|
75
75
|
distribution: fetch_distribution,
|
76
76
|
editorialgroup: fetch_editorialgroup,
|
77
77
|
classification: fetch_classification,
|
78
|
-
job_number: hit[:job_number]
|
78
|
+
job_number: hit[:job_number],
|
79
79
|
)
|
80
80
|
end
|
81
81
|
# rubocop:enable Metrics/MethodLength
|
@@ -109,7 +109,7 @@ module RelatonUn
|
|
109
109
|
|
110
110
|
# @return [Array<RelatonBib::TypedUri>]
|
111
111
|
def fetch_link
|
112
|
-
hit[:link].map { |l| RelatonBib::TypedUri.new
|
112
|
+
hit[:link].map { |l| RelatonBib::TypedUri.new(**l) }
|
113
113
|
end
|
114
114
|
|
115
115
|
# @return [Array<String>]
|
@@ -128,10 +128,10 @@ module RelatonUn
|
|
128
128
|
end
|
129
129
|
|
130
130
|
# @return [RelatonUn::EditorialGroup, NilClass]
|
131
|
-
def fetch_editorialgroup
|
132
|
-
tc = hit[:ref].match(
|
131
|
+
def fetch_editorialgroup # rubocop:disable Metrics/AbcSize
|
132
|
+
tc = hit[:ref].match(/^\S+/).to_s.split(/\/|-/).reduce([]) do |m, v|
|
133
133
|
if BODY[v] then m << BODY[v]
|
134
|
-
elsif v.match?
|
134
|
+
elsif v.match?(/(AC|C|CN|CONF|GC|SC|Sub|WG).\d+|PC/) then m << v
|
135
135
|
else m
|
136
136
|
end
|
137
137
|
end.uniq
|
data/lib/relaton_un/processor.rb
CHANGED
@@ -29,7 +29,7 @@ module RelatonUn
|
|
29
29
|
# @return [RelatonIsoBib::IsoBibliographicItem]
|
30
30
|
def hash_to_bib(hash)
|
31
31
|
item_hash = ::RelatonUn::HashConverter.hash_to_bib(hash)
|
32
|
-
::RelatonUn::UnBibliographicItem.new
|
32
|
+
::RelatonUn::UnBibliographicItem.new(**item_hash)
|
33
33
|
end
|
34
34
|
|
35
35
|
# Returns hash of XML grammar
|
@@ -10,8 +10,8 @@ module RelatonUn
|
|
10
10
|
HitCollection.new text
|
11
11
|
rescue SocketError, Errno::EINVAL, Errno::ECONNRESET, EOFError,
|
12
12
|
Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError,
|
13
|
-
Net::ProtocolError, Net::ReadTimeout,
|
14
|
-
Errno::ETIMEDOUT => e
|
13
|
+
Net::ProtocolError, Net::ReadTimeout, Net::OpenTimeout,
|
14
|
+
OpenSSL::SSL::SSLError, Errno::ETIMEDOUT => e
|
15
15
|
raise RelatonBib::RequestError,
|
16
16
|
"Could not access #{HitCollection::DOMAIN}: #{e.message}"
|
17
17
|
end
|
@@ -22,7 +22,7 @@ module RelatonUn
|
|
22
22
|
# @return [RelatonUn::UnBibliographicItem]
|
23
23
|
def get(ref, _year = nil, _opts = {})
|
24
24
|
warn "[relaton-un] (\"#{ref}\") fetching..."
|
25
|
-
/^(UN\s)?(?<code>.*)/ =~ ref
|
25
|
+
/^(?:UN\s)?(?<code>.*)/ =~ ref
|
26
26
|
result = isobib_search_filter(code)
|
27
27
|
if result
|
28
28
|
warn "[relaton-un] (\"#{ref}\") "\
|
data/lib/relaton_un/version.rb
CHANGED
@@ -6,7 +6,7 @@ module RelatonUn
|
|
6
6
|
# @param item_hash [Hash]
|
7
7
|
# @return [RelatonBib::BibliographicItem]
|
8
8
|
def bib_item(item_hash)
|
9
|
-
UnBibliographicItem.new
|
9
|
+
UnBibliographicItem.new(**item_hash)
|
10
10
|
end
|
11
11
|
|
12
12
|
# @param item [Nokogiri::XML::Element]
|
@@ -27,7 +27,7 @@ module RelatonUn
|
|
27
27
|
|
28
28
|
# @param ext [Nokogiri::XML::Element]
|
29
29
|
# @return [RelatonUn::Session]
|
30
|
-
def fetch_session(ext) # rubocop:disable Metrics/CyclomaticComplexity
|
30
|
+
def fetch_session(ext) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
31
31
|
session = ext.at "./session"
|
32
32
|
RelatonUn::Session.new(
|
33
33
|
session_number: session.at("number")&.text,
|
@@ -37,7 +37,7 @@ module RelatonUn
|
|
37
37
|
subitem_name: session.xpath("subitem-name").map(&:text),
|
38
38
|
collaborator: session.at("collaborator")&.text,
|
39
39
|
agenda_id: session.at("agenda-id")&.text,
|
40
|
-
item_footnote: session.at("item-footnote")&.text
|
40
|
+
item_footnote: session.at("item-footnote")&.text,
|
41
41
|
)
|
42
42
|
end
|
43
43
|
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
data/relaton_un.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
"use using the IsoBibliographicItem model"
|
16
16
|
spec.homepage = "https://github.com/relaton/relaton-un"
|
17
17
|
spec.license = "BSD-2-Clause"
|
18
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
18
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
19
19
|
|
20
20
|
spec.metadata["homepage_uri"] = spec.homepage
|
21
21
|
spec.metadata["source_code_uri"] = spec.homepage
|
@@ -32,10 +32,8 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
33
33
|
spec.require_paths = ["lib"]
|
34
34
|
|
35
|
-
# spec.add_development_dependency "debase"
|
36
35
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
37
36
|
spec.add_development_dependency "rake", "~> 10.0"
|
38
|
-
# spec.add_development_dependency "ruby-debug-ide"
|
39
37
|
spec.add_development_dependency "ruby-jing"
|
40
38
|
spec.add_development_dependency "simplecov"
|
41
39
|
spec.add_development_dependency "vcr"
|
@@ -43,7 +41,7 @@ Gem::Specification.new do |spec|
|
|
43
41
|
|
44
42
|
spec.add_dependency "faraday"
|
45
43
|
spec.add_dependency "http-cookie"
|
46
|
-
spec.add_dependency "relaton-bib", "~> 1.
|
44
|
+
spec.add_dependency "relaton-bib", "~> 1.9.0"
|
47
45
|
spec.add_dependency "unf_ext", ">= 0.0.7.7"
|
48
46
|
end
|
49
47
|
# rubocop:enable Metrics/BlockLength
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-un
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
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-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: equivalent-xml
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 1.
|
131
|
+
version: 1.9.0
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 1.
|
138
|
+
version: 1.9.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: unf_ext
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -201,7 +201,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
201
201
|
requirements:
|
202
202
|
- - ">="
|
203
203
|
- !ruby/object:Gem::Version
|
204
|
-
version: 2.
|
204
|
+
version: 2.5.0
|
205
205
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
206
206
|
requirements:
|
207
207
|
- - ">="
|