relaton-gb 1.14.0 → 1.16.1
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 -0
- data/.github/workflows/release.yml +5 -3
- data/.gitignore +1 -0
- data/.rubocop.yml +1 -1
- data/Gemfile +10 -1
- data/grammars/basicdoc.rng +0 -1
- data/grammars/biblio.rng +13 -3
- data/lib/relaton_gb/config.rb +10 -0
- data/lib/relaton_gb/gb_bibliographic_item.rb +0 -2
- data/lib/relaton_gb/gb_bibliography.rb +25 -24
- data/lib/relaton_gb/util.rb +9 -0
- data/lib/relaton_gb/version.rb +1 -1
- data/lib/relaton_gb.rb +9 -5
- data/relaton_gb.gemspec +2 -11
- metadata +11 -121
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9abe3c75ca613bc38c155fd5f116ecd967b06eecd7abc78610b498f107d6ec8f
|
4
|
+
data.tar.gz: a01b3c0b36e744d4518a54c2e41576a3c87a996468ff17b19a7981c5ed1a058d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f10cfd40d9314992bae8b704118d53b519ce1c5f2145139e61f816559f28adbc17703a34e02556af92694e99f5b78371d6fbcea2732d3d3556d181dc7876d811
|
7
|
+
data.tar.gz: f6373a69761f186b254ef5dfacbee6f195143b6cf522dc2da06a9667a4bfd4df90be3ac001de734034655b48072ab7dbca632f73f77ebf2fe196f19ff8a081d2
|
data/.github/workflows/rake.yml
CHANGED
@@ -7,11 +7,13 @@ on:
|
|
7
7
|
inputs:
|
8
8
|
next_version:
|
9
9
|
description: |
|
10
|
-
Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
|
10
|
+
Next release version. Possible values: x.y.z, major, minor, patch (or pre|rc|etc).
|
11
|
+
Also, you can pass 'skip' to skip 'git tag' and do 'gem push' for the current version
|
11
12
|
required: true
|
12
13
|
default: 'skip'
|
13
|
-
|
14
|
-
|
14
|
+
repository_dispatch:
|
15
|
+
types: [ do-release ]
|
16
|
+
|
15
17
|
|
16
18
|
jobs:
|
17
19
|
release:
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
@@ -3,7 +3,16 @@ Encoding.default_internal = Encoding::UTF_8
|
|
3
3
|
|
4
4
|
source "https://rubygems.org"
|
5
5
|
|
6
|
-
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
6
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
7
7
|
|
8
8
|
# Specify your gem's dependencies in gdbib.gemspec
|
9
9
|
gemspec
|
10
|
+
|
11
|
+
gem "equivalent-xml", "~> 0.6"
|
12
|
+
gem "pry-byebug"
|
13
|
+
gem "rake", "~> 13.0"
|
14
|
+
gem "rspec", "~> 3.0"
|
15
|
+
gem "ruby-jing"
|
16
|
+
gem "simplecov"
|
17
|
+
gem "vcr"
|
18
|
+
gem "webmock"
|
data/grammars/basicdoc.rng
CHANGED
data/grammars/biblio.rng
CHANGED
@@ -216,6 +216,9 @@
|
|
216
216
|
<optional>
|
217
217
|
<ref name="fullname"/>
|
218
218
|
</optional>
|
219
|
+
<zeroOrMore>
|
220
|
+
<ref name="credential"/>
|
221
|
+
</zeroOrMore>
|
219
222
|
<zeroOrMore>
|
220
223
|
<ref name="affiliation"/>
|
221
224
|
</zeroOrMore>
|
@@ -232,6 +235,11 @@
|
|
232
235
|
<ref name="FullNameType"/>
|
233
236
|
</element>
|
234
237
|
</define>
|
238
|
+
<define name="credential">
|
239
|
+
<element name="credential">
|
240
|
+
<text/>
|
241
|
+
</element>
|
242
|
+
</define>
|
235
243
|
<define name="FullNameType">
|
236
244
|
<choice>
|
237
245
|
<group>
|
@@ -305,7 +313,9 @@
|
|
305
313
|
<zeroOrMore>
|
306
314
|
<ref name="affiliationdescription"/>
|
307
315
|
</zeroOrMore>
|
308
|
-
<
|
316
|
+
<optional>
|
317
|
+
<ref name="organization"/>
|
318
|
+
</optional>
|
309
319
|
</element>
|
310
320
|
</define>
|
311
321
|
<define name="affiliationname">
|
@@ -1273,7 +1283,7 @@
|
|
1273
1283
|
<value>mergedInto</value>
|
1274
1284
|
<value>splits</value>
|
1275
1285
|
<value>splitInto</value>
|
1276
|
-
<value>
|
1286
|
+
<value>instanceOf</value>
|
1277
1287
|
<value>hasInstance</value>
|
1278
1288
|
<value>exemplarOf</value>
|
1279
1289
|
<value>hasExemplar</value>
|
@@ -1316,7 +1326,7 @@
|
|
1316
1326
|
<value>commentaryOf</value>
|
1317
1327
|
<value>hasCommentary</value>
|
1318
1328
|
<value>related</value>
|
1319
|
-
<value>
|
1329
|
+
<value>hasComplement</value>
|
1320
1330
|
<value>complementOf</value>
|
1321
1331
|
<value>obsoletes</value>
|
1322
1332
|
<value>obsoletedBy</value>
|
@@ -15,24 +15,25 @@ module RelatonGb
|
|
15
15
|
# @return [RelatonGb::HitCollection]
|
16
16
|
def search(text)
|
17
17
|
case text
|
18
|
-
when /^(GB|GJ|GS)/
|
18
|
+
# when /^(GB|GJ|GS)/
|
19
19
|
# Scrape national standards.
|
20
|
-
require "relaton_gb/gb_scrapper"
|
21
|
-
GbScrapper.scrape_page text
|
22
|
-
when /^ZB/
|
20
|
+
# require "relaton_gb/gb_scrapper"
|
21
|
+
# GbScrapper.scrape_page text
|
22
|
+
# when /^ZB/
|
23
23
|
# Scrape proffesional.
|
24
|
-
when /^DB/
|
24
|
+
# when /^DB/
|
25
25
|
# Scrape local standard.
|
26
|
-
when %r{^Q/}
|
26
|
+
# when %r{^Q/}
|
27
27
|
# Enterprise standard
|
28
|
-
when %r{^T/[^\s]{
|
28
|
+
when %r{^T/[^\s]{2,6}\s}
|
29
29
|
# Scrape social standard.
|
30
30
|
require "relaton_gb/t_scrapper"
|
31
31
|
TScrapper.scrape_page text
|
32
32
|
else
|
33
33
|
# Scrape sector standard.
|
34
|
-
require "relaton_gb/sec_scrapper"
|
35
|
-
SecScrapper.scrape_page text
|
34
|
+
# require "relaton_gb/sec_scrapper"
|
35
|
+
# SecScrapper.scrape_page text
|
36
|
+
[]
|
36
37
|
end
|
37
38
|
end
|
38
39
|
# rubocop:enable Metrics/MethodLength
|
@@ -41,7 +42,7 @@ module RelatonGb
|
|
41
42
|
# @param year [String] the year the standard was published (optional)
|
42
43
|
# @param opts [Hash] options; restricted to :all_parts if all-parts reference is required
|
43
44
|
# @return [String] Relaton XML serialisation of reference
|
44
|
-
def get(code, year = nil, opts = {})
|
45
|
+
def get(code, year = nil, opts = {}) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
45
46
|
if year.nil?
|
46
47
|
/^(?<code1>[^-]+)-(?<year1>[^-]+)$/ =~ code
|
47
48
|
unless code1.nil?
|
@@ -51,7 +52,7 @@ module RelatonGb
|
|
51
52
|
end
|
52
53
|
|
53
54
|
code += ".1" if opts[:all_parts]
|
54
|
-
code, year = code.split(
|
55
|
+
code, year = code.split("-", 2) if code.include?("-")
|
55
56
|
ret = get1(code, year, opts)
|
56
57
|
return nil if ret.nil?
|
57
58
|
|
@@ -62,22 +63,22 @@ module RelatonGb
|
|
62
63
|
|
63
64
|
private
|
64
65
|
|
65
|
-
def fetch_ref_err(code, year, missed_years)
|
66
|
+
def fetch_ref_err(code, year, missed_years) # rubocop:disable Metrics/MethodLength
|
66
67
|
id = year ? "#{code}:#{year}" : code
|
67
|
-
warn "
|
68
|
-
|
68
|
+
Util.warn "WARNING: no match found on the GB website for `#{id}`. " \
|
69
|
+
"The code must be exactly like it is on the website."
|
69
70
|
unless missed_years.empty?
|
70
|
-
warn "
|
71
|
-
|
71
|
+
Util.warn "(There was no match for `#{year}`, though there " \
|
72
|
+
"were matches found for `#{missed_years.join('`, `')}`.)"
|
72
73
|
end
|
73
74
|
if /\d-\d/.match? code
|
74
|
-
warn "
|
75
|
-
|
75
|
+
Util.warn "The provided document part may not exist, or " \
|
76
|
+
"the document may no longer be published in parts."
|
76
77
|
else
|
77
|
-
warn "
|
78
|
-
|
79
|
-
|
80
|
-
|
78
|
+
Util.warn "If you wanted to cite all document parts for the " \
|
79
|
+
"reference, use `#{code} (all parts)`.\nIf the document " \
|
80
|
+
"is not a standard, use its document type abbreviation " \
|
81
|
+
"(TS, TR, PAS, Guide)."
|
81
82
|
end
|
82
83
|
nil
|
83
84
|
end
|
@@ -88,7 +89,7 @@ module RelatonGb
|
|
88
89
|
result = search_filter(searchcode) || return
|
89
90
|
ret = results_filter(result, year)
|
90
91
|
if ret[:ret]
|
91
|
-
warn "
|
92
|
+
Util.warn "(#{code}) found `#{ret[:ret].docidentifier.first.id}`"
|
92
93
|
ret[:ret]
|
93
94
|
else
|
94
95
|
fetch_ref_err(code, year, ret[:years])
|
@@ -98,7 +99,7 @@ module RelatonGb
|
|
98
99
|
def search_filter(code)
|
99
100
|
# search filter needs to incorporate year
|
100
101
|
docidrx = %r{^[^\s]+\s[\d.-]+}
|
101
|
-
warn "
|
102
|
+
Util.warn "(#{code}) fetching..."
|
102
103
|
result = search(code)
|
103
104
|
result.select do |hit|
|
104
105
|
hit.docref && hit.docref.match(docidrx).to_s.include?(code)
|
data/lib/relaton_gb/version.rb
CHANGED
data/lib/relaton_gb.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
+
require "digest/md5"
|
2
|
+
require "relaton_iso_bib"
|
3
|
+
require "cnccs"
|
1
4
|
require "relaton_gb/version"
|
5
|
+
require "relaton_gb/config"
|
6
|
+
require "relaton_gb/util"
|
2
7
|
require "relaton_gb/gb_bibliography"
|
3
|
-
require "digest/md5"
|
4
8
|
|
5
9
|
# if defined? Relaton
|
6
10
|
# require "relaton_gb/processor"
|
@@ -14,9 +18,9 @@ module RelatonGb
|
|
14
18
|
# Returns hash of XML reammar
|
15
19
|
# @return [String]
|
16
20
|
def self.grammar_hash
|
17
|
-
gem_path = File.expand_path "..", __dir__
|
18
|
-
grammars_path = File.join gem_path, "grammars", "*"
|
19
|
-
grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
|
20
|
-
Digest::MD5.hexdigest grammars
|
21
|
+
# gem_path = File.expand_path "..", __dir__
|
22
|
+
# grammars_path = File.join gem_path, "grammars", "*"
|
23
|
+
# grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
|
24
|
+
Digest::MD5.hexdigest RelatonGb::VERSION + RelatonIsoBib::VERSION + RelatonBib::VERSION # grammars
|
21
25
|
end
|
22
26
|
end
|
data/relaton_gb.gemspec
CHANGED
@@ -22,18 +22,9 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.bindir = "exe"
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
24
|
spec.require_paths = ["lib"]
|
25
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
26
|
-
|
27
|
-
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
28
|
-
spec.add_development_dependency "pry-byebug"
|
29
|
-
spec.add_development_dependency "rake", "~> 13.0"
|
30
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
31
|
-
spec.add_development_dependency "ruby-jing"
|
32
|
-
spec.add_development_dependency "simplecov"
|
33
|
-
spec.add_development_dependency "vcr"
|
34
|
-
spec.add_development_dependency "webmock"
|
25
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
35
26
|
|
36
27
|
spec.add_dependency "cnccs", "~> 0.1.1"
|
37
28
|
spec.add_dependency "gb-agencies", "~> 0.0.1"
|
38
|
-
spec.add_dependency "relaton-iso-bib", "~> 1.
|
29
|
+
spec.add_dependency "relaton-iso-bib", "~> 1.16.0"
|
39
30
|
end
|
metadata
CHANGED
@@ -1,127 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-gb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.16.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: equivalent-xml
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0.6'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0.6'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: pry-byebug
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '13.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '13.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '3.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '3.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: ruby-jing
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: simplecov
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: vcr
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: webmock
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
13
|
- !ruby/object:Gem::Dependency
|
126
14
|
name: cnccs
|
127
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,14 +44,14 @@ dependencies:
|
|
156
44
|
requirements:
|
157
45
|
- - "~>"
|
158
46
|
- !ruby/object:Gem::Version
|
159
|
-
version: 1.
|
47
|
+
version: 1.16.0
|
160
48
|
type: :runtime
|
161
49
|
prerelease: false
|
162
50
|
version_requirements: !ruby/object:Gem::Requirement
|
163
51
|
requirements:
|
164
52
|
- - "~>"
|
165
53
|
- !ruby/object:Gem::Version
|
166
|
-
version: 1.
|
54
|
+
version: 1.16.0
|
167
55
|
description: 'RelatonGb: retrieve Chinese GB Standards for bibliographic use using
|
168
56
|
the BibliographicItem model.'
|
169
57
|
email:
|
@@ -192,6 +80,7 @@ files:
|
|
192
80
|
- grammars/relaton-gb.rng
|
193
81
|
- lib/relaton_gb.rb
|
194
82
|
- lib/relaton_gb/ccs.rb
|
83
|
+
- lib/relaton_gb/config.rb
|
195
84
|
- lib/relaton_gb/gb_bibliographic_item.rb
|
196
85
|
- lib/relaton_gb/gb_bibliography.rb
|
197
86
|
- lib/relaton_gb/gb_scrapper.rb
|
@@ -204,6 +93,7 @@ files:
|
|
204
93
|
- lib/relaton_gb/scrapper.rb
|
205
94
|
- lib/relaton_gb/sec_scrapper.rb
|
206
95
|
- lib/relaton_gb/t_scrapper.rb
|
96
|
+
- lib/relaton_gb/util.rb
|
207
97
|
- lib/relaton_gb/version.rb
|
208
98
|
- lib/relaton_gb/xml_parser.rb
|
209
99
|
- lib/relaton_gb/yaml/prefixes.yaml
|
@@ -212,7 +102,7 @@ homepage: https://github.com/metanorma/relaton_gb
|
|
212
102
|
licenses:
|
213
103
|
- BSD-2-Clause
|
214
104
|
metadata: {}
|
215
|
-
post_install_message:
|
105
|
+
post_install_message:
|
216
106
|
rdoc_options: []
|
217
107
|
require_paths:
|
218
108
|
- lib
|
@@ -220,15 +110,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
220
110
|
requirements:
|
221
111
|
- - ">="
|
222
112
|
- !ruby/object:Gem::Version
|
223
|
-
version: 2.
|
113
|
+
version: 2.7.0
|
224
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
225
115
|
requirements:
|
226
116
|
- - ">="
|
227
117
|
- !ruby/object:Gem::Version
|
228
118
|
version: '0'
|
229
119
|
requirements: []
|
230
|
-
rubygems_version: 3.
|
231
|
-
signing_key:
|
120
|
+
rubygems_version: 3.3.26
|
121
|
+
signing_key:
|
232
122
|
specification_version: 4
|
233
123
|
summary: 'RelatonGb: retrieve Chinese GB Standards for bibliographic use using the
|
234
124
|
BibliographicItem model.'
|