relaton-itu 1.7.2 → 1.7.3
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/grammars/itu.rng +13 -0
- data/lib/relaton_itu/itu_bibliographic_item.rb +1 -1
- data/lib/relaton_itu/itu_bibliography.rb +3 -3
- data/lib/relaton_itu/scrapper.rb +6 -6
- data/lib/relaton_itu/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 971645ffb5b0111df7d841c47f6ac1a64904cc85274218f2f6ff622dbba3b576
|
|
4
|
+
data.tar.gz: 68bc7e0bbb844896c7bf30c6d3e5747a9d6f0e68aa9384f9e761f2881f3be2bc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 83a9d8ee974bfe44cad5715db0199dfcf1eec9709d2a1d778d08cdc21379a69063bb6d6f0ee818b962f825c684d680bb4dda5cbba9b0ca48b24dc8dde4876cdd
|
|
7
|
+
data.tar.gz: 96a7cf63dd9ff84a115959d7766544e8d8f5f1328fa976737875b7808152939f1168e6a1644e0eb5e4af5cd22f6077b232cf45968e6945bc1a86d2a7721f8e19
|
data/grammars/itu.rng
CHANGED
|
@@ -42,6 +42,8 @@
|
|
|
42
42
|
<value>joint-itu-iso-iec</value>
|
|
43
43
|
<value>resolution</value>
|
|
44
44
|
<value>service-publication</value>
|
|
45
|
+
<value>handbook</value>
|
|
46
|
+
<value>question</value>
|
|
45
47
|
</choice>
|
|
46
48
|
</define>
|
|
47
49
|
<define name="editorialgroup">
|
|
@@ -98,6 +100,9 @@
|
|
|
98
100
|
<optional>
|
|
99
101
|
<ref name="meeting"/>
|
|
100
102
|
</optional>
|
|
103
|
+
<optional>
|
|
104
|
+
<ref name="meeting-place"/>
|
|
105
|
+
</optional>
|
|
101
106
|
<optional>
|
|
102
107
|
<ref name="meeting-date"/>
|
|
103
108
|
</optional>
|
|
@@ -128,6 +133,14 @@
|
|
|
128
133
|
</include>
|
|
129
134
|
<define name="meeting">
|
|
130
135
|
<element name="meeting">
|
|
136
|
+
<optional>
|
|
137
|
+
<attribute name="acronym"/>
|
|
138
|
+
</optional>
|
|
139
|
+
<text/>
|
|
140
|
+
</element>
|
|
141
|
+
</define>
|
|
142
|
+
<define name="meeting-place">
|
|
143
|
+
<element name="meeting-place">
|
|
131
144
|
<text/>
|
|
132
145
|
</element>
|
|
133
146
|
</define>
|
|
@@ -4,7 +4,7 @@ module RelatonItu
|
|
|
4
4
|
recommendation recommendation-supplement recommendation-amendment
|
|
5
5
|
recommendation-corrigendum recommendation-errata recommendation-annex
|
|
6
6
|
focus-group implementers-guide technical-paper technical-report
|
|
7
|
-
joint-itu-iso-iec
|
|
7
|
+
joint-itu-iso-iec resolution service-publication handbook question
|
|
8
8
|
].freeze
|
|
9
9
|
|
|
10
10
|
# @params structuredidentifier [RelatonItu::StructuredIdentifier]
|
|
@@ -30,7 +30,7 @@ module RelatonItu
|
|
|
30
30
|
# @param year [String] the year the standard was published (optional)
|
|
31
31
|
# @param opts [Hash] options; restricted to :all_parts if all-parts reference is required
|
|
32
32
|
# @return [String] Relaton XML serialisation of reference
|
|
33
|
-
def get(code, year = nil, opts = {})
|
|
33
|
+
def get(code, year = nil, opts = {}) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
|
34
34
|
if year.nil?
|
|
35
35
|
/^(?<code1>[^\s]+\s[^\s]+)\s\(\d{2}\/(?<year1>\d+)\)$/ =~ code
|
|
36
36
|
unless code1.nil?
|
|
@@ -50,7 +50,7 @@ module RelatonItu
|
|
|
50
50
|
|
|
51
51
|
private
|
|
52
52
|
|
|
53
|
-
def fetch_ref_err(code, year, missed_years)
|
|
53
|
+
def fetch_ref_err(code, year, missed_years) # rubocop:disable Metrics/MethodLength
|
|
54
54
|
id = year ? "#{code}:#{year}" : code
|
|
55
55
|
warn "[relaton-itu] WARNING: no match found online for #{id}. "\
|
|
56
56
|
"The code must be exactly like it is on the standards website."
|
|
@@ -67,7 +67,7 @@ module RelatonItu
|
|
|
67
67
|
nil
|
|
68
68
|
end
|
|
69
69
|
|
|
70
|
-
def search_filter(code, year)
|
|
70
|
+
def search_filter(code, year) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
|
71
71
|
%r{
|
|
72
72
|
^(?<pref1>ITU)?(-(?<type1>\w))?\s?(?<code1>[^\s\/]+)
|
|
73
73
|
(\s\(((?<month1>\d{2})\/)?(?<year1>\d{4})\))?
|
data/lib/relaton_itu/scrapper.rb
CHANGED
|
@@ -59,7 +59,7 @@ module RelatonItu
|
|
|
59
59
|
copyright: fetch_copyright(hit_data[:code], doc),
|
|
60
60
|
link: fetch_link(doc, url),
|
|
61
61
|
relation: fetch_relations(doc),
|
|
62
|
-
place: ["Geneva"]
|
|
62
|
+
place: ["Geneva"]
|
|
63
63
|
)
|
|
64
64
|
end
|
|
65
65
|
# rubocop:enable Metrics/AbcSize
|
|
@@ -92,7 +92,7 @@ module RelatonItu
|
|
|
92
92
|
uri = URI url
|
|
93
93
|
resp = Net::HTTP.get_response(uri)
|
|
94
94
|
until resp.code == "200"
|
|
95
|
-
uri = URI resp["location"] if resp.code
|
|
95
|
+
uri = URI resp["location"] if resp.code.match? /^30/
|
|
96
96
|
resp = Net::HTTP.get_response(uri)
|
|
97
97
|
end
|
|
98
98
|
[uri.to_s, Nokogiri::HTML(resp.body)]
|
|
@@ -156,13 +156,13 @@ module RelatonItu
|
|
|
156
156
|
group = wg && itugroup(wg.text)
|
|
157
157
|
EditorialGroup.new(
|
|
158
158
|
bureau: code.match(/(?<=-)./).to_s,
|
|
159
|
-
group: group
|
|
159
|
+
group: group
|
|
160
160
|
)
|
|
161
161
|
end
|
|
162
162
|
|
|
163
163
|
# @param name [String]
|
|
164
164
|
# @return [RelatonItu::ItuGroup]
|
|
165
|
-
def itugroup(name)
|
|
165
|
+
def itugroup(name) # rubocop:disable Metrics/MethodLength
|
|
166
166
|
if name.include? "Study Group"
|
|
167
167
|
type = "study-group"
|
|
168
168
|
acronym = "SG"
|
|
@@ -204,7 +204,7 @@ module RelatonItu
|
|
|
204
204
|
# Fetch dates
|
|
205
205
|
# @param doc [Nokogiri::HTML::Document]
|
|
206
206
|
# @return [Array<Hash>]
|
|
207
|
-
def fetch_dates(doc)
|
|
207
|
+
def fetch_dates(doc) # rubocop:disable Metrics/CyclomaticComplexity
|
|
208
208
|
dates = []
|
|
209
209
|
date = doc.at("//table/tr/td/span[contains(@id, 'Label5')]",
|
|
210
210
|
"//p[contains(.,'Approved in')]")
|
|
@@ -258,7 +258,7 @@ module RelatonItu
|
|
|
258
258
|
links = [{ type: "src", content: url }]
|
|
259
259
|
obp_elm = doc.at(
|
|
260
260
|
'//a[@title="Persistent link to download the PDF file"]',
|
|
261
|
-
"//font[contains(.,'PDF')]/../.."
|
|
261
|
+
"//font[contains(.,'PDF')]/../.."
|
|
262
262
|
)
|
|
263
263
|
links << typed_link("obp", obp_elm) if obp_elm
|
|
264
264
|
wrd_elm = doc.at("//font[contains(.,'Word')]/../..")
|
data/lib/relaton_itu/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-itu
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.7.
|
|
4
|
+
version: 1.7.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-01-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: debase
|