relaton-itu 1.10.0 → 1.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/grammars/biblio.rng +5 -3
- data/lib/relaton_itu/itu_bibliography.rb +17 -19
- data/lib/relaton_itu/scrapper.rb +9 -9
- data/lib/relaton_itu/version.rb +1 -1
- data/relaton-itu.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8796a2554f57885c83de19e32da701739f5c511e092a8abf4113061b598ae35
|
4
|
+
data.tar.gz: 976353ac63cd5e3b5a625cac2012995601ec7d8d3af5563e72e57cf5a6462bf0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 338f6a059cdbfeba44c7a08a54193f1a5f8f423b53d8088d966379b7af6b6bf31ec03b9af441fe8b4daf0f80dc784e53c8fbbddda494b41aa9d7638231c9cec9
|
7
|
+
data.tar.gz: 9c8db8b401cc4f3fef51611d528d957f9924cb9686c17e495846b3f4afde903cab27e61b2e94d51160b13f9234f99b82d7605f91836c463eb07fe5f113ad34af
|
data/grammars/biblio.rng
CHANGED
@@ -209,9 +209,6 @@
|
|
209
209
|
<zeroOrMore>
|
210
210
|
<ref name="contact"/>
|
211
211
|
</zeroOrMore>
|
212
|
-
<zeroOrMore>
|
213
|
-
<ref name="uri"/>
|
214
|
-
</zeroOrMore>
|
215
212
|
</element>
|
216
213
|
</define>
|
217
214
|
<define name="fullname">
|
@@ -828,6 +825,11 @@
|
|
828
825
|
<optional>
|
829
826
|
<attribute name="scope"/>
|
830
827
|
</optional>
|
828
|
+
<optional>
|
829
|
+
<attribute name="primary">
|
830
|
+
<data type="boolean"/>
|
831
|
+
</attribute>
|
832
|
+
</optional>
|
831
833
|
<text/>
|
832
834
|
</element>
|
833
835
|
</define>
|
@@ -39,7 +39,7 @@ module RelatonItu
|
|
39
39
|
# @return [String] Relaton XML serialisation of reference
|
40
40
|
def get(code, year = nil, opts = {}) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
41
41
|
if year.nil?
|
42
|
-
/^(?<code1>[^\s]+\s[^\s]+)\s\((
|
42
|
+
/^(?<code1>[^\s]+\s[^\s]+)\s\((?:\d{2}\/)?(?<year1>\d+)\)$/ =~ code
|
43
43
|
unless code1.nil?
|
44
44
|
code = code1
|
45
45
|
year = year1
|
@@ -78,35 +78,33 @@ module RelatonItu
|
|
78
78
|
|
79
79
|
def search_filter(code, year) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
80
80
|
%r{
|
81
|
-
^(?<pref1>ITU)?(
|
82
|
-
(
|
83
|
-
(
|
84
|
-
(
|
85
|
-
(
|
86
|
-
(
|
81
|
+
^(?<pref1>ITU)?(?:-(?<type1>\w))?\s?(?<code1>[^\s/]+(?:/\w[.\d]+)?)
|
82
|
+
(?:\s\(?(?<ver1>v\d+)\)?)?
|
83
|
+
(?:\s\((?:(?<month1>\d{2})/)?(?<year1>\d{4})\))?
|
84
|
+
(?:\s-\s(?<buldate1>\d{2}\.\w{1,4}\.\d{4}))?
|
85
|
+
(?:\s(?<corr1>(?:Amd|Cor|Amendment|Corrigendum)\.?\s?\d+))?
|
86
|
+
(?:\s\((?:(?<cormonth1>\d{2})/)?(?<coryear1>\d{4})\))?
|
87
87
|
}x =~ code
|
88
88
|
year ||= year1
|
89
|
-
# docidrx = %r{\w+\.\d+|\w\sSuppl\.\s\d+} # %r{^ITU-T\s[^\s]+}
|
90
|
-
# c = code.sub(/Imp\s?/, "").match(docidrx).to_s
|
91
89
|
warn "[relaton-itu] (\"#{code}\") fetching..."
|
92
90
|
result = search(code)
|
93
|
-
code1.sub!
|
91
|
+
code1.sub!(/(?<=\.)Imp(?=\d)/, "") if result.gi_imp
|
94
92
|
if corr1
|
95
|
-
corr1.sub!(/[
|
93
|
+
corr1.sub!(/[.\s]+/, " ").sub!("Amendment", "Amd")
|
96
94
|
corr1.sub!("Corrigendum", "Corr")
|
97
95
|
end
|
98
96
|
result.select do |i|
|
99
97
|
next true unless i.hit[:code]
|
100
98
|
|
101
99
|
%r{
|
102
|
-
^(?<pref2>ITU)?(
|
103
|
-
(
|
104
|
-
(
|
105
|
-
(
|
106
|
-
(
|
100
|
+
^(?<pref2>ITU)?(?:-(?<type2>\w))?\s?(?<code2>\S+)
|
101
|
+
(?:\s\(?(?<ver2>v\d+)\)?)?
|
102
|
+
(?:\s\((?:(?<month2>\d{2})/)?(?<year2>\d{4})\))?
|
103
|
+
(?:\s(?<corr2>(?:Amd|Cor)\.\s?\d+))?
|
104
|
+
(?:\s\((?:(?<cormonth2>\d{2})/)?(?<coryear2>\d{4})\))?
|
107
105
|
}x =~ i.hit[:code]
|
108
|
-
/:[
|
109
|
-
corr2&.sub!
|
106
|
+
/:[^(]+\((?<buldate2>\d{2}\.\w{1,4}\.\d{4})\)/ =~ i.hit[:title]
|
107
|
+
corr2&.sub!(/\.\s?/, " ")
|
110
108
|
pref1 == pref2 && (!type1 || type1 == type2) && code2.include?(code1) &&
|
111
109
|
(!year || year == year2) && (!month1 || month1 == month2) &&
|
112
110
|
corr1 == corr2 && (!coryear1 || coryear1 == coryear2) &&
|
@@ -124,7 +122,7 @@ module RelatonItu
|
|
124
122
|
def isobib_results_filter(result, year)
|
125
123
|
missed_years = []
|
126
124
|
result.each do |r|
|
127
|
-
/\((
|
125
|
+
/\((?:\d{2}\/)?(?<pyear>\d{4})\)/ =~ r.hit[:code]
|
128
126
|
if !year || year == pyear
|
129
127
|
ret = r.fetch
|
130
128
|
return { ret: ret } if ret
|
data/lib/relaton_itu/scrapper.rb
CHANGED
@@ -59,7 +59,7 @@ module RelatonItu
|
|
59
59
|
copyright: fetch_copyright(hit.hit[:code], doc),
|
60
60
|
link: fetch_link(doc),
|
61
61
|
relation: fetch_relations(doc),
|
62
|
-
place: ["Geneva"]
|
62
|
+
place: ["Geneva"],
|
63
63
|
)
|
64
64
|
end
|
65
65
|
|
@@ -109,7 +109,7 @@ module RelatonItu
|
|
109
109
|
docids = doc.xpath(
|
110
110
|
"//span[@id='ctl00_content_main_uc_rec_main_info1_rpt_main_ctl00_lbl_rec']",
|
111
111
|
"//td[.='Identical standard:']/following-sibling::td",
|
112
|
-
"//div/table[1]/tr[4]/td/strong"
|
112
|
+
"//div/table[1]/tr[4]/td/strong",
|
113
113
|
).map { |c| createdocid c.text }
|
114
114
|
docids << createdocid(title) unless docids.any?
|
115
115
|
docids
|
@@ -119,18 +119,18 @@ module RelatonItu
|
|
119
119
|
# @return [RelatonBib::DocumentIdentifier]
|
120
120
|
def createdocid(text) # rubocop:disable Metrics/MethodLength
|
121
121
|
%r{
|
122
|
-
^(?<code>((ITU-\w|ISO
|
123
|
-
(
|
124
|
-
(
|
125
|
-
(
|
122
|
+
^(?<code>(?:(?:ITU-\w|ISO/IEC)\s)?[^(:]+)
|
123
|
+
(?:\((?:(?<_month>\d{2})/)?(?<_year>\d{4})\))?
|
124
|
+
(?::[^(]+\((?<buldate>\d{2}\.\w{1,4}\.\d{4})\))?
|
125
|
+
(?:\s(?<corr>(?:Amd|Cor)\.\s?\d+))?
|
126
126
|
# (\s\(((?<_cormonth>\d{2})\/)?(?<_coryear>\d{4})\))?
|
127
127
|
}x =~ text.squeeze(" ")
|
128
|
-
corr&.sub!
|
128
|
+
corr&.sub!(/\.\s?/, " ")
|
129
129
|
id = [code.sub(/[[:space:]]$/, ""), corr].compact.join " "
|
130
130
|
id += " - #{buldate}" if buldate
|
131
131
|
type = id.match(%r{^\w+}).to_s
|
132
132
|
type = "ITU" if type == "G"
|
133
|
-
RelatonBib::DocumentIdentifier.new(type: type, id: id)
|
133
|
+
RelatonBib::DocumentIdentifier.new(type: type, id: id, primary: true)
|
134
134
|
end
|
135
135
|
|
136
136
|
# Fetch status.
|
@@ -261,7 +261,7 @@ module RelatonItu
|
|
261
261
|
links = [{ type: "src", content: doc.uri.to_s }]
|
262
262
|
obp_elm = doc.at(
|
263
263
|
'//a[@title="Persistent link to download the PDF file"]',
|
264
|
-
"//font[contains(.,'PDF')]/../.."
|
264
|
+
"//font[contains(.,'PDF')]/../..",
|
265
265
|
)
|
266
266
|
links << typed_link("obp", obp_elm) if obp_elm
|
267
267
|
wrd_elm = doc.at("//font[contains(.,'Word')]/../..")
|
data/lib/relaton_itu/version.rb
CHANGED
data/relaton-itu.gemspec
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.10.
|
4
|
+
version: 1.10.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: 2022-
|
11
|
+
date: 2022-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: equivalent-xml
|
@@ -142,14 +142,14 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 1.10.
|
145
|
+
version: 1.10.1
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 1.10.
|
152
|
+
version: 1.10.1
|
153
153
|
description: 'RelatonItu: retrieve ITU Standards for bibliographic use using the BibliographicItem
|
154
154
|
model'
|
155
155
|
email:
|