relaton-oasis 1.18.0 → 1.18.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/grammars/basicdoc.rng +3 -0
- data/lib/relaton_oasis/data_parser.rb +6 -3
- data/lib/relaton_oasis/data_parser_utils.rb +29 -12
- data/lib/relaton_oasis/data_part_parser.rb +12 -7
- data/lib/relaton_oasis/version.rb +1 -1
- data/relaton_oasis.gemspec +1 -1
- 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: dac6ccdcd3852748aecbcc84c9ed6e5228fe321ab6659de9d7bf2233f9850c5a
|
4
|
+
data.tar.gz: 285d6b583d9ba375a41be2c82dc1c025353cb39e160c76652eef266170fbbf69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9ff1cebaef0e7b8ea8e995aa47b9686042ff3e7ceb764dd6abbb4b60f3f16eee529514bd3a029d818ed55c1e1d05f214c578a4430592dc2f8231d356a94db66
|
7
|
+
data.tar.gz: d814e66a65fb439b70ba32ce02942d26c20ea83c741f0ebb14b9299eb38ada6ae90367db992554c168f7f4d04f556501ca9e6eaedf8d2e043473faad1a7dae4a
|
data/grammars/basicdoc.rng
CHANGED
@@ -165,14 +165,17 @@ module RelatonOasis
|
|
165
165
|
|
166
166
|
#
|
167
167
|
# Parse document number.
|
168
|
+
# If the docuemnt has no parts, the document number is constructed from the title.
|
169
|
+
# If the document had one part, the document number is constructed from the part.
|
170
|
+
# If the document has parts, the document number is constructed from the parts.
|
168
171
|
#
|
169
172
|
# @return [String] document number
|
170
173
|
#
|
171
174
|
def parse_docnumber
|
172
175
|
parts = document_part_refs
|
173
176
|
case parts.size
|
174
|
-
when 0 then title_to_docid
|
175
|
-
when 1 then parse_spec(parts[0])
|
177
|
+
when 0 then parse_spec title_to_docid(@node.at("./summary/div/h2").text)
|
178
|
+
when 1 then parse_part parse_spec(parts[0])
|
176
179
|
else parts_to_docid parts
|
177
180
|
end
|
178
181
|
end
|
@@ -194,7 +197,7 @@ module RelatonOasis
|
|
194
197
|
end
|
195
198
|
end
|
196
199
|
end.join("-")
|
197
|
-
parse_spec(id)
|
200
|
+
parse_part parse_spec(id)
|
198
201
|
end
|
199
202
|
|
200
203
|
#
|
@@ -34,12 +34,30 @@ module RelatonOasis
|
|
34
34
|
if link_node && link_node[:href].match?(/\.html$/)
|
35
35
|
agent = Mechanize.new
|
36
36
|
agent.agent.allowed_error_codes = [404]
|
37
|
-
|
38
|
-
|
39
|
-
@page = resp if resp.code == "200"
|
37
|
+
resp = retry_page(link_node[:href], agent)
|
38
|
+
@page = resp if resp && resp.code == "200"
|
40
39
|
end
|
41
40
|
end
|
42
41
|
|
42
|
+
#
|
43
|
+
# Retry to get page.
|
44
|
+
#
|
45
|
+
# @param [String] url page URL
|
46
|
+
# @param [Mechanize] agent HTTP client
|
47
|
+
# @param [Integer] retries number of retries
|
48
|
+
#
|
49
|
+
# @return [Mechanize::Page, nil] page or nil
|
50
|
+
#
|
51
|
+
def retry_page(url, agent, retries = 3)
|
52
|
+
sleep 1 # to avoid 429 error
|
53
|
+
agent.get url
|
54
|
+
rescue Errno::ETIMEDOUT, Net::OpenTimeout => e
|
55
|
+
retry if (retries -= 1).positive?
|
56
|
+
Util.error "Failed to get page `#{url}`"
|
57
|
+
Util.error e.message
|
58
|
+
nil
|
59
|
+
end
|
60
|
+
|
43
61
|
def parse_chairs
|
44
62
|
return [] unless page
|
45
63
|
|
@@ -96,12 +114,11 @@ module RelatonOasis
|
|
96
114
|
# @return [String] document identifier with specification if needed
|
97
115
|
#
|
98
116
|
def parse_spec(num)
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
parse_part(id)
|
117
|
+
case text
|
118
|
+
when /OASIS Project Specification (\d+)/ then "#{num}-PS#{$1}"
|
119
|
+
when /Committee Specification (\d+)/ then "#{num}-CS#{$1}"
|
120
|
+
else num
|
121
|
+
end
|
105
122
|
end
|
106
123
|
|
107
124
|
#
|
@@ -169,9 +186,9 @@ module RelatonOasis
|
|
169
186
|
# @return [Array<String>] technology areas
|
170
187
|
#
|
171
188
|
def parse_technology_area(node)
|
172
|
-
node.xpath(
|
173
|
-
"
|
174
|
-
|
189
|
+
node.xpath("./summary/div/div/ul[@class='technology-areas__list']/li/a").map do |ta|
|
190
|
+
ta.text.strip.gsub(/\s/, "-").sub("development", "Development")
|
191
|
+
end
|
175
192
|
end
|
176
193
|
end
|
177
194
|
end
|
@@ -13,9 +13,15 @@ module RelatonOasis
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def text
|
16
|
-
@text
|
17
|
-
|
18
|
-
|
16
|
+
return @text if @text
|
17
|
+
|
18
|
+
if @node.at("./strong/following-sibling::text()|./span[strong]/following-sibling::text()")
|
19
|
+
@text = @node.xpath(
|
20
|
+
"./strong/following-sibling::node()|./span[strong]/following-sibling::node()",
|
21
|
+
).text.strip
|
22
|
+
else
|
23
|
+
@text = @node.xpath("./following-sibling::p[1][em]").text.strip
|
24
|
+
end
|
19
25
|
end
|
20
26
|
|
21
27
|
def title
|
@@ -72,7 +78,7 @@ module RelatonOasis
|
|
72
78
|
id = parse_errata(num)
|
73
79
|
# some part references need to be added by "Pt" to be distinguishable from root doc
|
74
80
|
id += "-Pt" if %w[CMIS-v1.1 DocBook-5.0 XACML-V3.0 mqtt-v3.1.1 OData-JSON-Format-v4.0].include?(id)
|
75
|
-
parse_spec id
|
81
|
+
parse_part parse_spec id
|
76
82
|
end
|
77
83
|
|
78
84
|
#
|
@@ -81,8 +87,7 @@ module RelatonOasis
|
|
81
87
|
# @return [Array<RelatonBib::TypedTitleString>] link
|
82
88
|
#
|
83
89
|
def parse_link
|
84
|
-
|
85
|
-
[RelatonBib::TypedUri.new(type: "src", content: l[:href])]
|
90
|
+
[RelatonBib::TypedUri.new(type: "src", content: link_node[:href])]
|
86
91
|
end
|
87
92
|
|
88
93
|
#
|
@@ -139,7 +144,7 @@ module RelatonOasis
|
|
139
144
|
end
|
140
145
|
|
141
146
|
def link_node
|
142
|
-
@link_node = @node.at("./a")
|
147
|
+
@link_node = @node.at("./a|./following-sibling::p[1]/a")
|
143
148
|
end
|
144
149
|
|
145
150
|
#
|
data/relaton_oasis.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
32
32
|
spec.require_paths = ["lib"]
|
33
33
|
|
34
|
-
spec.add_dependency "mechanize", "~> 2.
|
34
|
+
spec.add_dependency "mechanize", "~> 2.10"
|
35
35
|
spec.add_dependency "multi_json", "~> 1.15.0"
|
36
36
|
spec.add_dependency "relaton-bib", "~> 1.18.0"
|
37
37
|
spec.add_dependency "relaton-index", "~> 0.2.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-oasis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.18.
|
4
|
+
version: 1.18.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: 2024-
|
11
|
+
date: 2024-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mechanize
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: '2.10'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: '2.10'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: multi_json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
128
|
- !ruby/object:Gem::Version
|
129
129
|
version: '0'
|
130
130
|
requirements: []
|
131
|
-
rubygems_version: 3.3.
|
131
|
+
rubygems_version: 3.3.27
|
132
132
|
signing_key:
|
133
133
|
specification_version: 4
|
134
134
|
summary: 'RelatonOasis: retrieve OASIS Standards for bibliographic use using the BibliographicItem
|