relaton-iso 0.6.9 → 0.6.10

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: 7f7708895d02ce29c36eca68bfd8d8f91f7259fa0ee60d1f26395fe88a651fde
4
- data.tar.gz: 1c1a521df3375c790014c2fb089e290dc783a58188ef671c1c758678df466593
3
+ metadata.gz: 25c121931e586894fa45da9041d1e9d745a786c414a972841e20bffb65ca2a48
4
+ data.tar.gz: 9bccdfa26525a65d037d885ed888c8b7119fa4aed30be7381521cf3e721b3b7b
5
5
  SHA512:
6
- metadata.gz: 2b328dc10023ac43ffd7e3dccdc686aae17b42d9e15c1c5158ba66477c0b61779c7d40cb066ac2eaf3040070a958f47fa738fbd8cfe85a1e9be629351c129e7b
7
- data.tar.gz: a5decdbe0993ff219bd6be31321f8a4fa79e79f4e2b24d540cd1f7b4eee8631a1729b4a1e46f2b6296fac013f960e325d433270762ecd35d2110ea21e8f3db98
6
+ metadata.gz: 6a93ab39ba0f02dce79c20ccd4a5c61fe9e2a9a989b30d474d2b647c0f292b69df7a0f5d3af38a86474ee9366a535d45eada5c31f8195da0dc07116acc85b2e7
7
+ data.tar.gz: 8b7530c5bc8aedeb67ce78ce17741b1857b13afd567d66eedcf06f0b13a44272b1d4805177c876de5841b2cda6c4ea247e95c75439343808c523b7075fd9d6f1
@@ -0,0 +1,29 @@
1
+ # Auto-generated !!! Do not edit it manually
2
+ # use ci-master https://github.com/metanorma/metanorma-build-scripts
3
+ name: macos
4
+
5
+ on: [push]
6
+
7
+ jobs:
8
+ test-macos:
9
+ name: Test on Ruby ${{ matrix.ruby }} macOS
10
+ runs-on: macos-latest
11
+ strategy:
12
+ matrix:
13
+ ruby: [ '2.6', '2.5', '2.4' ]
14
+ steps:
15
+ - uses: actions/checkout@master
16
+ with:
17
+ submodules: recursive
18
+ - name: Use Ruby
19
+ uses: actions/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{ matrix.ruby }}
22
+ architecture: 'x64'
23
+ - name: Update gems
24
+ run: |
25
+ sudo gem install bundler -v "~> 2" --force
26
+ bundle install --jobs 4 --retry 3
27
+ - name: Run specs
28
+ run: |
29
+ bundle exec rake
@@ -0,0 +1,29 @@
1
+ # Auto-generated !!! Do not edit it manually
2
+ # use ci-master https://github.com/metanorma/metanorma-build-scripts
3
+ name: ubuntu
4
+
5
+ on: [push]
6
+
7
+ jobs:
8
+ test-linux:
9
+ name: Test on Ruby ${{ matrix.ruby }} Ubuntu
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ ruby: [ '2.6', '2.5', '2.4' ]
14
+ steps:
15
+ - uses: actions/checkout@master
16
+ with:
17
+ submodules: recursive
18
+ - name: Use Ruby
19
+ uses: actions/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{ matrix.ruby }}
22
+ architecture: 'x64'
23
+ - name: Update gems
24
+ run: |
25
+ gem install bundler -v "~> 2"
26
+ bundle install --jobs 4 --retry 3
27
+ - name: Run specs
28
+ run: |
29
+ bundle exec rake
@@ -0,0 +1,32 @@
1
+ # Auto-generated !!! Do not edit it manually
2
+ # use ci-master https://github.com/metanorma/metanorma-build-scripts
3
+ name: windows
4
+
5
+ on: [push]
6
+
7
+ jobs:
8
+ test-windows:
9
+ name: Test on Ruby ${{ matrix.ruby }} Windows
10
+ runs-on: windows-latest
11
+ strategy:
12
+ matrix:
13
+ ruby: [ '2.6', '2.5', '2.4' ]
14
+ steps:
15
+ - uses: actions/checkout@master
16
+ with:
17
+ submodules: recursive
18
+ - name: Use Ruby
19
+ uses: actions/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{ matrix.ruby }}
22
+ architecture: 'x64'
23
+ - name: Update gems
24
+ shell: pwsh
25
+ run: |
26
+ gem install bundler -v "~> 2"
27
+ bundle config --local path vendor/bundle
28
+ bundle update
29
+ bundle install --jobs 4 --retry 3
30
+ - name: Run specs
31
+ run: |
32
+ bundle exec rake
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- relaton-iso (0.6.9)
4
+ relaton-iso (0.6.10)
5
5
  relaton-iec (~> 0.4.0)
6
6
  relaton-iso-bib (~> 0.3.0)
7
7
 
@@ -39,7 +39,7 @@ GEM
39
39
  relaton-bib (0.3.12)
40
40
  addressable
41
41
  nokogiri
42
- relaton-iec (0.4.10)
42
+ relaton-iec (0.4.11)
43
43
  addressable
44
44
  relaton-iso-bib (~> 0.3.0)
45
45
  relaton-iso-bib (0.3.12)
@@ -92,4 +92,4 @@ DEPENDENCIES
92
92
  webmock
93
93
 
94
94
  BUNDLED WITH
95
- 2.0.1
95
+ 2.0.2
@@ -23,7 +23,7 @@ module RelatonIso
23
23
  def initialize(text)
24
24
  @array = []
25
25
  @text = text
26
- %r{(?<num>\d+)(-(?<part>\d+))?} =~ text
26
+ %r{\s(?<num>\d+)(-(?<part>\d+))?} =~ text
27
27
  http = Net::HTTP.new "www.iso.org", 443
28
28
  http.use_ssl = true
29
29
  search = ["status=ENT_ACTIVE,ENT_PROGRESS,ENT_INACTIVE,ENT_DELETED"]
@@ -71,10 +71,13 @@ module RelatonIso
71
71
  # end
72
72
 
73
73
  def to_all_parts
74
- hit = @array.min_by { |h| h.hit["docPart"].to_i }
74
+ parts = @array.select { |h| !h.hit["docPart"].empty? }
75
+ hit = parts.min_by { |h| h.hit["docPart"].to_i }
76
+ return @array.first.fetch unless hit
77
+
75
78
  bibitem = hit.fetch
76
79
  bibitem.to_all_parts
77
- @array.reject { |h| h.hit["docRef"] == hit.hit["docRef"] }.each do |hi|
80
+ parts.reject { |h| h.hit["docRef"] == hit.hit["docRef"] }.each do |hi|
78
81
  isobib = RelatonIsoBib::IsoBibliographicItem.new(
79
82
  formattedref: RelatonBib::FormattedRef.new(content: hi.hit["docRef"]),
80
83
  )
@@ -40,21 +40,19 @@ module RelatonIso
40
40
  code = code1 if code1
41
41
 
42
42
  if year.nil?
43
- /^(?<code1>[^\s]+(\s\w+)?\s[\d-]+):?(?<year1>\d{4})?/ =~ code
43
+ /^(?<code1>[^\s]+(\s\w+)?\s[\d-]+)(:(?<year1>\d{4}))?(?<code2>\s\w+)?/ =~ code
44
44
  unless code1.nil?
45
- code = code1
45
+ code = code1 + code2.to_s
46
46
  year = year1
47
47
  end
48
48
  end
49
- opts[:all_parts] ||= code !~ %r{^[^\s]+\s\d+-\d+} && opts[:all_parts].nil?
50
- # code += "-1" if all_parts
49
+ opts[:all_parts] ||= code !~ %r{^[^\s]+\s\d+-\d+} && opts[:all_parts].nil? && code2.nil?
51
50
  return RelatonIec::IecBibliography.get(code, year, opts) if %r[^ISO/IEC DIR] =~ code
52
51
 
53
52
  ret = isobib_get1(code, year, corr, opts)
54
53
  return nil if ret.nil?
55
54
 
56
55
  ret.to_most_recent_reference unless year || opts[:keep_year] || opts[:all_parts]
57
- # ret.to_all_parts if all_parts
58
56
  ret
59
57
  end
60
58
 
@@ -118,13 +116,14 @@ module RelatonIso
118
116
  end
119
117
 
120
118
  def try_stages(result, corr, opts)
119
+ res = nil
121
120
  %w[NP WD CD DIS FDIS PRF IS AWI].each do |st| # try stages
122
121
  warn "Attempting #{st} stage retrieval"
123
122
  c = yield st
124
123
  res = search_code result, c, corr, opts
125
124
  return res unless res.empty?
126
125
  end
127
- result
126
+ res
128
127
  end
129
128
 
130
129
  def search_code(result, code, corr, opts)
@@ -145,9 +144,9 @@ module RelatonIso
145
144
  def isobib_results_filter(result, year, opts)
146
145
  missed_years = []
147
146
  hits = result.reduce!([]) do |hts, h|
148
- if !year && h.hit["publicationStatus"] == "Withdrawn"
149
- hts
150
- elsif !year || %r{:(?<iyear>\d{4})} =~ h.hit["docRef"] && iyear == year
147
+ # if !year && h.hit["publicationStatus"] == "Withdrawn"
148
+ # hts
149
+ if !year || %r{:(?<iyear>\d{4})} =~ h.hit["docRef"] && iyear == year
151
150
  hts << h
152
151
  else
153
152
  missed_years << iyear
@@ -7,7 +7,7 @@ module RelatonIso
7
7
  def initialize
8
8
  @short = :relaton_iso
9
9
  @prefix = "ISO"
10
- @defaultprefix = %r{^(ISO)[ /]}
10
+ @defaultprefix = %r{^ISO(/IEC)?\s}
11
11
  @idtype = "ISO"
12
12
  end
13
13
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonIso
4
- VERSION = "0.6.9"
4
+ VERSION = "0.6.10"
5
5
  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: 0.6.9
4
+ version: 0.6.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-31 00:00:00.000000000 Z
11
+ date: 2019-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -200,18 +200,19 @@ executables: []
200
200
  extensions: []
201
201
  extra_rdoc_files: []
202
202
  files:
203
+ - ".github/workflows/macos.yml"
204
+ - ".github/workflows/ubuntu.yml"
205
+ - ".github/workflows/windows.yml"
203
206
  - ".gitignore"
204
207
  - ".hound.yml"
205
208
  - ".rspec"
206
209
  - ".rubocop.yml"
207
- - ".travis.yml"
208
210
  - CODE_OF_CONDUCT.md
209
211
  - Gemfile
210
212
  - Gemfile.lock
211
213
  - LICENSE.txt
212
214
  - README.adoc
213
215
  - Rakefile
214
- - appveyor.yml
215
216
  - bin/bundle
216
217
  - bin/byebug
217
218
  - bin/coderay
@@ -1,18 +0,0 @@
1
- # Auto-generated !!! Do not edit it manually
2
- # use ci-master https://github.com/metanorma/metanorma-build-scripts
3
- language: ruby
4
- cache: bundler
5
- os:
6
- - linux
7
- - osx
8
- rvm:
9
- - 2.6
10
- - 2.5
11
- - 2.4
12
- - ruby-head
13
- before_install:
14
- - gem install bundler -v "~> 2"
15
- - bundle update
16
- matrix:
17
- allow_failures:
18
- - rvm: ruby-head
@@ -1,37 +0,0 @@
1
- # Auto-generated !!! Do not edit it manually
2
- # use ci-master https://github.com/metanorma/metanorma-build-scripts
3
- version: '{build}'
4
-
5
- cache:
6
- - vendor/bundle
7
-
8
- environment:
9
- matrix:
10
- - RUBY_VERSION: 26
11
- - RUBY_VERSION: 25
12
- - RUBY_VERSION: 24
13
- - RUBY_VERSION: _trunk
14
-
15
- matrix:
16
- allow_failures:
17
- - RUBY_VERSION: _trunk
18
-
19
- install:
20
- - ps: . { iwr -useb https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/appveyor.ps1 } | iex
21
- - refreshenv
22
-
23
- build_script:
24
- - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
25
- - set GIT_TERMINAL_PROMPT=0
26
- - gem install bundler -v "~> 2"
27
- - bundle config --local path vendor/bundle
28
- - bundle update
29
- - bundle install
30
-
31
- before_test:
32
- - ruby -v
33
- - gem -v
34
- - bundle -v
35
-
36
- test_script:
37
- - bundle exec rake