relaton-gb 1.12.1 → 1.13.0
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 +8 -5
- data/grammars/isodoc.rng +27 -1
- data/lib/relaton_gb/t_scrapper.rb +4 -4
- data/lib/relaton_gb/version.rb +1 -1
- data/relaton_gb.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: 2f3844801b9c641a154e348f6353bd015852bb2397188c78cf0eff2db6195a4b
|
4
|
+
data.tar.gz: 4dabafff1ae9b09e935e0c4f1942ba4db625b9321cdfe64bda829dc2aa2e64fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffd17de2c4b98e5a75d538d85d0cb21b612a46f911af2ebf4e05a61e4d8e839956c1f3bb54a9aa02bd954ac0ebfd937b0a9614ed952d896c9c487abab2ce5b8a
|
7
|
+
data.tar.gz: 587cfd65266caf303f1b5ceb2a67288411c23fba83bf06057ee0aed2b071e8f5c44bf34e6444ed2e4490ffaf771955d9c46ce3db2a475955c843b2b07473776e
|
data/grammars/biblio.rng
CHANGED
@@ -225,9 +225,9 @@
|
|
225
225
|
<zeroOrMore>
|
226
226
|
<ref name="forename"/>
|
227
227
|
</zeroOrMore>
|
228
|
-
<
|
229
|
-
<ref name="
|
230
|
-
</
|
228
|
+
<optional>
|
229
|
+
<ref name="formatted-initials"/>
|
230
|
+
</optional>
|
231
231
|
<ref name="surname"/>
|
232
232
|
<zeroOrMore>
|
233
233
|
<ref name="addition"/>
|
@@ -247,8 +247,8 @@
|
|
247
247
|
<ref name="LocalizedString"/>
|
248
248
|
</element>
|
249
249
|
</define>
|
250
|
-
<define name="
|
251
|
-
<element name="
|
250
|
+
<define name="formatted-initials">
|
251
|
+
<element name="formatted-initials">
|
252
252
|
<ref name="LocalizedString"/>
|
253
253
|
</element>
|
254
254
|
</define>
|
@@ -264,6 +264,9 @@
|
|
264
264
|
</define>
|
265
265
|
<define name="forename">
|
266
266
|
<element name="forename">
|
267
|
+
<optional>
|
268
|
+
<attribute name="initial"/>
|
269
|
+
</optional>
|
267
270
|
<ref name="LocalizedString"/>
|
268
271
|
</element>
|
269
272
|
</define>
|
data/grammars/isodoc.rng
CHANGED
@@ -69,6 +69,17 @@
|
|
69
69
|
</zeroOrMore>
|
70
70
|
</element>
|
71
71
|
</define>
|
72
|
+
<define name="AdmonitionType">
|
73
|
+
<choice>
|
74
|
+
<value>warning</value>
|
75
|
+
<value>note</value>
|
76
|
+
<value>tip</value>
|
77
|
+
<value>important</value>
|
78
|
+
<value>caution</value>
|
79
|
+
<value>statement</value>
|
80
|
+
<value>editorial</value>
|
81
|
+
</choice>
|
82
|
+
</define>
|
72
83
|
<define name="index">
|
73
84
|
<element name="index">
|
74
85
|
<optional>
|
@@ -1274,7 +1285,12 @@
|
|
1274
1285
|
</define>
|
1275
1286
|
<define name="span">
|
1276
1287
|
<element name="span">
|
1277
|
-
<
|
1288
|
+
<optional>
|
1289
|
+
<attribute name="class"/>
|
1290
|
+
</optional>
|
1291
|
+
<optional>
|
1292
|
+
<attribute name="style"/>
|
1293
|
+
</optional>
|
1278
1294
|
<oneOrMore>
|
1279
1295
|
<ref name="TextElement"/>
|
1280
1296
|
</oneOrMore>
|
@@ -2493,6 +2509,16 @@
|
|
2493
2509
|
<text/>
|
2494
2510
|
</element>
|
2495
2511
|
</optional>
|
2512
|
+
<optional>
|
2513
|
+
<element name="amendment">
|
2514
|
+
<text/>
|
2515
|
+
</element>
|
2516
|
+
</optional>
|
2517
|
+
<optional>
|
2518
|
+
<element name="corrigendum">
|
2519
|
+
<text/>
|
2520
|
+
</element>
|
2521
|
+
</optional>
|
2496
2522
|
<optional>
|
2497
2523
|
<element name="language">
|
2498
2524
|
<text/>
|
@@ -20,8 +20,8 @@ module RelatonGb
|
|
20
20
|
# @return [RelatonGb::HitCollection]
|
21
21
|
def scrape_page(text)
|
22
22
|
search_html = OpenURI.open_uri(
|
23
|
-
"http://www.ttbz.org.cn/Home/Standard?searchType=2&key="
|
24
|
-
CGI.escape(text.tr(
|
23
|
+
"http://www.ttbz.org.cn/Home/Standard?searchType=2&key=" \
|
24
|
+
"#{CGI.escape(text.tr('-', [8212].pack('U')))}",
|
25
25
|
).read
|
26
26
|
header = Nokogiri::HTML search_html
|
27
27
|
xpath = '//table[contains(@class, "standard_list_table")]/tr/td/a'
|
@@ -29,7 +29,7 @@ module RelatonGb
|
|
29
29
|
hits = header.xpath(xpath).map do |h|
|
30
30
|
docref = h.at(t_xpath).text.gsub(/â\u0080\u0094/, "-")
|
31
31
|
status = h.at("../preceding-sibling::td[1]").text.delete "\r\n"
|
32
|
-
pid = h[:href].sub(%r{
|
32
|
+
pid = h[:href].sub(%r{/$}, "")
|
33
33
|
Hit.new pid: pid, docref: docref, status: status, scrapper: self
|
34
34
|
end
|
35
35
|
HitCollection.new hits
|
@@ -43,7 +43,7 @@ module RelatonGb
|
|
43
43
|
def scrape_doc(hit)
|
44
44
|
src = "http://www.ttbz.org.cn#{hit.pid}"
|
45
45
|
doc = Nokogiri::HTML OpenURI.open_uri(src), nil, Encoding::UTF_8.to_s
|
46
|
-
GbBibliographicItem.new
|
46
|
+
GbBibliographicItem.new(**scrapped_data(doc, src, hit))
|
47
47
|
rescue OpenURI::HTTPError, SocketError, OpenSSL::SSL::SSLError, Net::OpenTimeout
|
48
48
|
raise RelatonBib::RequestError, "Cannot access #{src}"
|
49
49
|
end
|
data/lib/relaton_gb/version.rb
CHANGED
data/relaton_gb.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-gb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.13.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: 2022-
|
11
|
+
date: 2022-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: equivalent-xml
|
@@ -156,14 +156,14 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 1.
|
159
|
+
version: 1.13.0
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: 1.
|
166
|
+
version: 1.13.0
|
167
167
|
description: 'RelatonGb: retrieve Chinese GB Standards for bibliographic use using
|
168
168
|
the BibliographicItem model.'
|
169
169
|
email:
|