relaton-calconnect 1.8.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +1 -11
- data/.rubocop.yml +1 -1
- data/grammars/biblio.rng +1 -0
- data/grammars/csd.rng +3 -0
- data/grammars/isodoc.rng +72 -10
- data/lib/relaton_calconnect/cc_bibliographic_item.rb +1 -1
- data/lib/relaton_calconnect/cc_bibliography.rb +6 -10
- data/lib/relaton_calconnect/hit_collection.rb +3 -3
- data/lib/relaton_calconnect/version.rb +1 -1
- data/lib/relaton_calconnect/xml_parser.rb +2 -2
- data/relaton_calconnect.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: 1c3a78f7962d9b70c4dc6a30bd002f9973998f55d52af6612f63beb58e5109bf
|
4
|
+
data.tar.gz: e0f8ac1a2c0c676dca4e1f3ebf0ae044a453a143824f953e860017777b01a587
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66e83c6550539dcacb9583e9f90d67666b70ac9e39b8802a737741600b88ee3c1ca11c7cd9275acccc9ef023e9602a3495f573f75d76845070864f4335e64e8b
|
7
|
+
data.tar.gz: c7ace3d658e7c003847a1cc46b11385cf868d9fc47812e57c46d8ce08a87f865aa61a63b3e5724cc4a9c4554ca90d014cc7cdd7627ed9d09444c07aeba168c19
|
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/csd.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>
|
@@ -3,7 +3,7 @@ module RelatonCalconnect
|
|
3
3
|
class << self
|
4
4
|
# @param text [String]
|
5
5
|
# @return [RelatonCalconnect::HitCollection]
|
6
|
-
def search(text, year = nil,
|
6
|
+
def search(text, year = nil, _opts = {})
|
7
7
|
HitCollection.new text, year
|
8
8
|
rescue Faraday::ConnectionFailed
|
9
9
|
raise RelatonBib::RequestError, "Could not access https://standards.calconnect.org"
|
@@ -18,11 +18,11 @@ module RelatonCalconnect
|
|
18
18
|
# @option opts [TrueClass, FalseClass] :bibdata
|
19
19
|
#
|
20
20
|
# @return [RelatonCalconnect::CcBibliographicItem]
|
21
|
-
def get(ref, year = nil, opts = {})
|
21
|
+
def get(ref, year = nil, opts = {}) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
22
22
|
code = ref
|
23
23
|
|
24
24
|
if year.nil?
|
25
|
-
/^(?<code1>[^\s]+(
|
25
|
+
/^(?<code1>[^\s]+(?:\s\w+)?\s[\d-]+):?(?<year1>\d{4})?/ =~ ref
|
26
26
|
unless code1.nil?
|
27
27
|
code = code1
|
28
28
|
year = year1
|
@@ -30,7 +30,7 @@ module RelatonCalconnect
|
|
30
30
|
end
|
31
31
|
|
32
32
|
warn "[relaton-calconnect] (\"#{ref}\") fetching..."
|
33
|
-
result =
|
33
|
+
result = search(code, year, opts) || (return nil)
|
34
34
|
ret = bib_results_filter(result, year)
|
35
35
|
if ret[:ret]
|
36
36
|
warn "[relaton-calconnect] (\"#{ref}\") found #{ret[:ret].docidentifier.first.id}"
|
@@ -42,10 +42,6 @@ module RelatonCalconnect
|
|
42
42
|
|
43
43
|
private
|
44
44
|
|
45
|
-
def bib_search_filter(code, year, opts)
|
46
|
-
search(code, year, opts)
|
47
|
-
end
|
48
|
-
|
49
45
|
# Sort through the results from RelatonNist, fetching them three at a time,
|
50
46
|
# and return the first result that matches the code,
|
51
47
|
# matches the year (if provided), and which # has a title (amendments do not).
|
@@ -80,8 +76,8 @@ module RelatonCalconnect
|
|
80
76
|
warn "[relaton-calconnect] WARNING: no match found online for #{id}. "\
|
81
77
|
"The code must be exactly like it is on the standards website."
|
82
78
|
unless missed_years.empty?
|
83
|
-
warn "[relaton-calconnect] (There was no match for #{year}, though
|
84
|
-
"found for #{missed_years.join(', ')}.)"
|
79
|
+
warn "[relaton-calconnect] (There was no match for #{year}, though "\
|
80
|
+
"there were matches found for #{missed_years.join(', ')}.)"
|
85
81
|
end
|
86
82
|
nil
|
87
83
|
end
|
@@ -23,7 +23,7 @@ module RelatonCalconnect
|
|
23
23
|
private
|
24
24
|
|
25
25
|
#
|
26
|
-
# Fetch data
|
26
|
+
# Fetch data from yaml
|
27
27
|
#
|
28
28
|
# @param docid [String]
|
29
29
|
def from_yaml(docid, **_opts)
|
@@ -44,7 +44,7 @@ module RelatonCalconnect
|
|
44
44
|
end
|
45
45
|
|
46
46
|
#
|
47
|
-
# fetch data
|
47
|
+
# fetch data from server and save it to file.
|
48
48
|
#
|
49
49
|
def fetch_data
|
50
50
|
resp = Faraday.new(ENDPOINT, headers: { "If-None-Match" => etag }).get
|
@@ -57,7 +57,7 @@ module RelatonCalconnect
|
|
57
57
|
end
|
58
58
|
|
59
59
|
#
|
60
|
-
# Read ETag
|
60
|
+
# Read ETag from file
|
61
61
|
#
|
62
62
|
# @return [String, NilClass]
|
63
63
|
def etag
|
@@ -5,7 +5,7 @@ module RelatonCalconnect
|
|
5
5
|
# @param item_hash [Hash]
|
6
6
|
# @return [RelatonIsoBib::IsoBibliographicItem]
|
7
7
|
def bib_item(item_hash)
|
8
|
-
CcBibliographicItem.new
|
8
|
+
CcBibliographicItem.new(**item_hash)
|
9
9
|
end
|
10
10
|
|
11
11
|
# @param ext [Nokogiri::XML::Element]
|
@@ -14,7 +14,7 @@ module RelatonCalconnect
|
|
14
14
|
return unless ext && (eg = ext.at "editorialgroup")
|
15
15
|
|
16
16
|
eg = eg.xpath("committee", "technical-committee").map do |tc|
|
17
|
-
wg = RelatonBib::WorkGroup.new(
|
17
|
+
wg = RelatonBib::WorkGroup.new(name: tc.text, number: tc[:number]&.to_i,
|
18
18
|
type: tc[:type])
|
19
19
|
TechnicalCommittee.new wg
|
20
20
|
end
|
data/relaton_calconnect.gemspec
CHANGED
@@ -24,18 +24,16 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.bindir = "exe"
|
25
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
26
|
spec.require_paths = ["lib"]
|
27
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
27
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
28
28
|
|
29
|
-
# spec.add_development_dependency "debase"
|
30
29
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
31
30
|
spec.add_development_dependency "rake", "~> 10.0"
|
32
31
|
spec.add_development_dependency "rspec", "~> 3.0"
|
33
|
-
# spec.add_development_dependency "ruby-debug-ide"
|
34
32
|
spec.add_development_dependency "ruby-jing"
|
35
33
|
spec.add_development_dependency "simplecov"
|
36
34
|
spec.add_development_dependency "vcr"
|
37
35
|
spec.add_development_dependency "webmock"
|
38
36
|
|
39
37
|
spec.add_dependency "faraday"
|
40
|
-
spec.add_dependency "relaton-bib", "~> 1.
|
38
|
+
spec.add_dependency "relaton-bib", "~> 1.9.0"
|
41
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-calconnect
|
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
|
description: 'RelatonIso: retrieve CC Standards for bibliographic use using the IsoBibliographicItem
|
140
140
|
model'
|
141
141
|
email:
|
@@ -184,7 +184,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
184
184
|
requirements:
|
185
185
|
- - ">="
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version: 2.
|
187
|
+
version: 2.5.0
|
188
188
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
189
|
requirements:
|
190
190
|
- - ">="
|