relaton-iso 1.10.0 → 1.11.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd281fdcf928bfe44ad8f9b162f09e75a9c25835c93625ed9416ebf60c0a7c8d
4
- data.tar.gz: f24e00ea160d81d7c932f77b35639b119955f291ec4c5c0c60de64ab87fcce70
3
+ metadata.gz: 57aaa988aba37afa1e4cc8eced55b20d46eda761cad5fc8a68ac33c3793afb82
4
+ data.tar.gz: 0ff660f7a7ffb558659c9d8577f075cfea9e225c2d9a7bf44d209745b0d7fc76
5
5
  SHA512:
6
- metadata.gz: 5739dbe20f4fe2b841057b720569db621ac96e5aba68f2c1aedd7c3977a3e227c1d424f1c34d513c429b30e9eb0dd18fda807e4833bb0bc04f9d91a172c5ad2f
7
- data.tar.gz: 59b4bb9fd476e1f2cf275001f0d799140782e79b539e5f8d4458c5849d36eda7aaac040a366b7803206ecd4c9906c994c1209d8dafce44d64d61cc997a22bd86
6
+ metadata.gz: 8ef87dc1073df8b8653989494fda55f54cdcd780aaaa9d16e0af6e0ec6778021d73a2e81b23b18b751e95b2c607f6c27a49af50d8df1bbb95c7d9b7df76e3977
7
+ data.tar.gz: 154c64258dfc69a6ae01822593e0e9759648cc2f773c126f4474cd0aad8483a16e208613ccd582e94f4ea38c4c996cee089c5d5b844782f93ae2ec33be17151c
data/Gemfile CHANGED
@@ -1,6 +1,3 @@
1
- Encoding.default_external = Encoding::UTF_8
2
- Encoding.default_internal = Encoding::UTF_8
3
-
4
1
  source "https://rubygems.org"
5
2
 
6
3
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
@@ -31,8 +31,7 @@ module RelatonIso
31
31
  def get(ref, year = nil, opts = {}) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity,Metrics/AbcSize
32
32
  code = ref.gsub(/\u2013/, "-")
33
33
  # %r{\s(?<num>\d+)(?:-(?<part>[\d-]+))?(?::(?<year1>\d{4}))?} =~ code
34
- _, _part, year1, = ref_components ref
35
- year ||= year1
34
+ year ||= publish_year ref
36
35
  code.sub! " (all parts)", ""
37
36
  opts[:all_parts] ||= $~ && opts[:all_parts].nil?
38
37
  # opts[:keep_year] ||= opts[:keep_year].nil?
@@ -41,7 +40,7 @@ module RelatonIso
41
40
  # return RelatonIec::IecBibliography.get(code, year, opts)
42
41
  # end
43
42
 
44
- ret = isobib_get1(code, year, opts)
43
+ ret = isobib_get(code, year, opts)
45
44
  return nil if ret.nil?
46
45
 
47
46
  if (year && opts[:keep_year].nil?) || opts[:keep_year] || opts[:all_parts]
@@ -166,7 +165,8 @@ module RelatonIso
166
165
  def isobib_results_filter(result, year, opts)
167
166
  missed_years = []
168
167
  hits = result.reduce!([]) do |hts, h|
169
- if !year || (%r{:(?<iyear>\d{4})(?!.*:\d{4})} =~ h.hit[:title] && iyear == year)
168
+ iyear = publish_year h.hit[:title]
169
+ if !year || iyear == year
170
170
  hts << h
171
171
  else
172
172
  missed_years << iyear
@@ -183,10 +183,15 @@ module RelatonIso
183
183
  end
184
184
  # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
185
185
 
186
+ def publish_year(ref)
187
+ %r{:(?<year>\d{4})(?!.*:\d{4})} =~ ref
188
+ year
189
+ end
190
+
186
191
  # @param code [String]
187
192
  # @param year [String, NilClass]
188
193
  # @param opts [Hash]
189
- def isobib_get1(code, year, opts)
194
+ def isobib_get(code, year, opts)
190
195
  # return iev(code) if /^IEC 60050-/.match code
191
196
  result = isobib_search_filter(code, opts) || return
192
197
  ret = isobib_results_filter(result, year, opts)
@@ -176,7 +176,7 @@ module RelatonIso
176
176
  def fetch_docid(doc, edition, langs)
177
177
  pubid = item_ref doc
178
178
  [
179
- RelatonBib::DocumentIdentifier.new(id: pubid, type: "ISO"),
179
+ RelatonBib::DocumentIdentifier.new(id: pubid, type: "ISO", primary: true),
180
180
  RelatonBib::DocumentIdentifier.new(
181
181
  id: fetch_urn(doc, pubid, edition, langs), type: "URN",
182
182
  ),
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonIso
4
- VERSION = "1.10.0"
4
+ VERSION = "1.11.1"
5
5
  end
data/relaton_iso.gemspec CHANGED
@@ -42,5 +42,5 @@ Gem::Specification.new do |spec|
42
42
 
43
43
  # spec.add_dependency "relaton-iec", "~> 1.8.0"
44
44
  spec.add_dependency "algolia"
45
- spec.add_dependency "relaton-iso-bib", "~> 1.10.0"
45
+ spec.add_dependency "relaton-iso-bib", "~> 1.11.0"
46
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-iso
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.11.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-01-30 00:00:00.000000000 Z
11
+ date: 2022-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug
@@ -184,14 +184,14 @@ dependencies:
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: 1.10.0
187
+ version: 1.11.0
188
188
  type: :runtime
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: 1.10.0
194
+ version: 1.11.0
195
195
  description: 'RelatonIso: retrieve ISO Standards for bibliographic use using the IsoBibliographicItem
196
196
  model'
197
197
  email: