relaton-iec 1.16.0 → 1.16.1
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/lib/relaton_iec/config.rb +10 -0
- data/lib/relaton_iec/iec_bibliographic_item.rb +4 -6
- data/lib/relaton_iec/iec_bibliography.rb +13 -23
- data/lib/relaton_iec/util.rb +9 -0
- data/lib/relaton_iec/version.rb +1 -1
- data/lib/relaton_iec.rb +6 -4
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22c30d32d348985a90f88d21872741162ebef459ccff4fc118597f196e53f4b9
|
4
|
+
data.tar.gz: 5a265ce8efceee119c822824eb347ace8aeedd9f695b23b7270a22d150da3678
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6f4575283e266b8f35c28b88ff70ec1653c35222e6283d62385c883c459a3a65b096b5ed7495b68a40f4b99760f2e741d59ce4c370556180d0e41bc3d04f529
|
7
|
+
data.tar.gz: 76d9702d3434cf7a7c3b1dfc4e03e9be53ca2e49c801c5dc2060b7574e3d3c023ade59074daeb628a00eb57e1792860d8d35073228594baf0e897917d2b3c9d1
|
@@ -34,15 +34,13 @@ module RelatonIec
|
|
34
34
|
#
|
35
35
|
def initialize(**args) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
36
36
|
if args[:function] && !FUNCTION.include?(args[:function])
|
37
|
-
warn "
|
38
|
-
warn "
|
37
|
+
Util.warn "WARNING: invalid function `#{args[:function]}`"
|
38
|
+
Util.warn "allowed function values are: `#{FUNCTION.join('`, `')}`"
|
39
39
|
end
|
40
40
|
if args[:updates_document_type] &&
|
41
41
|
!DOCTYPES.include?(args[:updates_document_type])
|
42
|
-
warn "
|
43
|
-
|
44
|
-
warn "[relaton-iec] allowed updates_document_type values are: " \
|
45
|
-
"#{DOCTYPES.join(', ')}"
|
42
|
+
Util.warn "WARNING: invalid updates_document_type `#{args[:updates_document_type]}`"
|
43
|
+
Util.warn "allowed updates_document_type values are: `#{DOCTYPES.join('`, `')}`"
|
46
44
|
end
|
47
45
|
@function = args.delete :function
|
48
46
|
@updates_document_type = args.delete :updates_document_type
|
@@ -46,9 +46,8 @@ module RelatonIec
|
|
46
46
|
# @param missed_years [Array<String>]
|
47
47
|
def warn_missing_years(pubid, year, missed_years)
|
48
48
|
id = ref_with_year(pubid, year)
|
49
|
-
warn "
|
50
|
-
|
51
|
-
"but matches exist for #{missed_years.uniq.join(', ')}."
|
49
|
+
Util.warn "(#{id}) TIP: No match for edition year `#{year}`, " \
|
50
|
+
"but matches exist for `#{missed_years.uniq.join('`, `')}`."
|
52
51
|
end
|
53
52
|
|
54
53
|
# @param code [String]
|
@@ -57,9 +56,7 @@ module RelatonIec
|
|
57
56
|
def fetch_ref_err(code, year, missed_years) # rubocop:disable Metrics/MethodLength
|
58
57
|
id = ref_with_year(code, year)
|
59
58
|
|
60
|
-
warn "
|
61
|
-
"Not found. "\
|
62
|
-
"The identifier must be exactly as shown on the IEC Webstore."
|
59
|
+
Util.warn "(#{id}) Not found. The identifier must be exactly as shown on the IEC Webstore."
|
63
60
|
|
64
61
|
if year && missed_years.any?
|
65
62
|
warn_missing_years(code, year, missed_years)
|
@@ -68,13 +65,11 @@ module RelatonIec
|
|
68
65
|
# TODO: change this to pubid-iec
|
69
66
|
has_part = /\d-\d/.match?(code)
|
70
67
|
if has_part
|
71
|
-
warn "
|
72
|
-
"If it cannot be found, the document may no longer be published in parts."
|
68
|
+
Util.warn "(#{id}) TIP: If it cannot be found, the document may no longer be published in parts."
|
73
69
|
|
74
70
|
else
|
75
|
-
warn "
|
76
|
-
|
77
|
-
"use (\"#{code} (all parts)\")."
|
71
|
+
Util.warn "(#{id}) TIP: If you wish to cite all document parts for " \
|
72
|
+
"the reference, use `#{code} (all parts)`."
|
78
73
|
end
|
79
74
|
|
80
75
|
# TODO: streamline after integration with pubid-iec
|
@@ -83,9 +78,8 @@ module RelatonIec
|
|
83
78
|
code.include?("#{t} ")
|
84
79
|
end
|
85
80
|
unless selected_doctype
|
86
|
-
warn "
|
87
|
-
|
88
|
-
"deliverable type abbreviation (#{doctypes.join(", ")})."
|
81
|
+
Util.warn "(#{id}) TIP: If the document is not an International Standard, use its " \
|
82
|
+
"deliverable type abbreviation `#{doctypes.join('`, `')}`."
|
89
83
|
end
|
90
84
|
|
91
85
|
nil
|
@@ -131,7 +125,7 @@ module RelatonIec
|
|
131
125
|
# @return [RelatonIec::HitCollection]
|
132
126
|
def search_filter(ref, year)
|
133
127
|
code = ref.split(":").first
|
134
|
-
warn "
|
128
|
+
Util.warn "(#{ref_with_year(ref, year)}) Fetching from IEC..."
|
135
129
|
search(code)
|
136
130
|
end
|
137
131
|
|
@@ -256,17 +250,13 @@ module RelatonIec
|
|
256
250
|
id = ref_with_year(code, year)
|
257
251
|
docid = ret[:ret].docidentifier.first.id
|
258
252
|
|
259
|
-
if id == docid
|
260
|
-
|
261
|
-
else
|
262
|
-
warn "[relaton-iec] (\"#{id}\") Found (\"#{docid}\")."
|
253
|
+
if id == docid then Util.warn "(#{id}) Found exact match."
|
254
|
+
else Util.warn "(#{id}) Found `#{docid}`."
|
263
255
|
end
|
264
256
|
|
265
257
|
if ret[:missed_parts]
|
266
|
-
warn "
|
267
|
-
|
268
|
-
"if you want to cite all parts, use "\
|
269
|
-
"(\"#{code} (all parts)\")."
|
258
|
+
Util.warn "(#{id}) TIP: `#{code}` also contains other parts, " \
|
259
|
+
"if you want to cite all parts, use `#{code} (all parts)`."
|
270
260
|
end
|
271
261
|
|
272
262
|
ret[:ret]
|
data/lib/relaton_iec/version.rb
CHANGED
data/lib/relaton_iec.rb
CHANGED
@@ -7,6 +7,8 @@ require "relaton/index"
|
|
7
7
|
require "relaton_iso_bib"
|
8
8
|
require "relaton_iec/hit"
|
9
9
|
require "relaton_iec/version"
|
10
|
+
require "relaton_iec/config"
|
11
|
+
require "relaton_iec/util"
|
10
12
|
require "relaton_iec/iec_bibliography"
|
11
13
|
require "relaton_iec/iec_bibliographic_item"
|
12
14
|
require "relaton_iec/xml_parser"
|
@@ -20,10 +22,10 @@ module RelatonIec
|
|
20
22
|
# Returns hash of XML reammar
|
21
23
|
# @return [String]
|
22
24
|
def grammar_hash
|
23
|
-
gem_path = File.expand_path "..", __dir__
|
24
|
-
grammars_path = File.join gem_path, "grammars", "*"
|
25
|
-
grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
|
26
|
-
Digest::MD5.hexdigest grammars
|
25
|
+
# gem_path = File.expand_path "..", __dir__
|
26
|
+
# grammars_path = File.join gem_path, "grammars", "*"
|
27
|
+
# grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
|
28
|
+
Digest::MD5.hexdigest RelatonIec::VERSION + RelatonIsoBib::VERSION + RelatonBib::VERSION # grammars
|
27
29
|
end
|
28
30
|
|
29
31
|
# @param code [String]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-iec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.16.
|
4
|
+
version: 1.16.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: 2023-09-
|
11
|
+
date: 2023-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -109,6 +109,7 @@ files:
|
|
109
109
|
- lib/relaton_iec/basic_block/stem.rb
|
110
110
|
- lib/relaton_iec/basic_block/table.rb
|
111
111
|
- lib/relaton_iec/basic_block/text_element.rb
|
112
|
+
- lib/relaton_iec/config.rb
|
112
113
|
- lib/relaton_iec/data_fetcher.rb
|
113
114
|
- lib/relaton_iec/data_parser.rb
|
114
115
|
- lib/relaton_iec/hash_converter.rb
|
@@ -120,6 +121,7 @@ files:
|
|
120
121
|
- lib/relaton_iec/processor.rb
|
121
122
|
- lib/relaton_iec/statuses.yml
|
122
123
|
- lib/relaton_iec/tc_sc_officers_note.rb
|
124
|
+
- lib/relaton_iec/util.rb
|
123
125
|
- lib/relaton_iec/version.rb
|
124
126
|
- lib/relaton_iec/xml_parser.rb
|
125
127
|
- relaton_iec.gemspec
|