isobib 0.2.3 → 0.2.5

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: 014de3839ec12b7fed6d51bdae6aa9184fc68d0ac9b0d3ce93e2612027131c23
4
- data.tar.gz: 5b56a485e23bcd6b62a807c65f7ba8ce7f01781105cfaa2d7c998424a2c808c0
3
+ metadata.gz: ff27e088b8184634663981a6df34301e5958e02b04ff94af0c36e9a0aa1c2e8f
4
+ data.tar.gz: a31f26d8fef8e57b7b04932c120ff55e7c5630cfe7a43c2a749f2edea693c1f2
5
5
  SHA512:
6
- metadata.gz: 3768a1e26e41ebae555e4ce56cad226b4fed37e11c2068f5002f7d24da07c3bd33f97f04a4e73a07f1375ba465000899e7a573b86c11078951b8b9dc461b59a1
7
- data.tar.gz: 2de63e7914bb7391048ff5d9dda3e47fe98ff2fac7d50326913b8588346f45e7f5d299ab49ac14b860222b508d8ac4ae2cfdde5d0a8c659462e72c6a128b1f62
6
+ metadata.gz: dfee675bebd17b8a4ede137b9e2006c5728335606c303501aaa8dfe495557e144c815d987d13f3549b44e857d5420becc0bde0631a9ea1e33b24c67bdd39d27f
7
+ data.tar.gz: aa37f8219f11525a6c02cff2f0f5b264c074739dcf81f0f6b13476f88ebd27a5798ba95cb5f94494612d28bb2d30beb82b4535420cf8aee2129153c7bff24cc9
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- isobib (0.2.2)
4
+ isobib (0.2.4)
5
5
  algoliasearch
6
6
  iso-bib-item (~> 0.2.4)
7
7
 
@@ -22,7 +22,7 @@ GEM
22
22
  isoics (~> 0.1.6)
23
23
  nokogiri (~> 1.8.4)
24
24
  ruby_deep_clone (~> 0.8.0)
25
- isoics (0.1.6)
25
+ isoics (0.1.7)
26
26
  json (2.1.0)
27
27
  method_source (0.9.0)
28
28
  mini_portile2 (2.3.0)
@@ -35,19 +35,19 @@ GEM
35
35
  byebug (~> 10.0)
36
36
  pry (~> 0.10)
37
37
  rake (10.5.0)
38
- rspec (3.7.0)
39
- rspec-core (~> 3.7.0)
40
- rspec-expectations (~> 3.7.0)
41
- rspec-mocks (~> 3.7.0)
42
- rspec-core (3.7.1)
43
- rspec-support (~> 3.7.0)
44
- rspec-expectations (3.7.0)
38
+ rspec (3.8.0)
39
+ rspec-core (~> 3.8.0)
40
+ rspec-expectations (~> 3.8.0)
41
+ rspec-mocks (~> 3.8.0)
42
+ rspec-core (3.8.0)
43
+ rspec-support (~> 3.8.0)
44
+ rspec-expectations (3.8.1)
45
45
  diff-lcs (>= 1.2.0, < 2.0)
46
- rspec-support (~> 3.7.0)
47
- rspec-mocks (3.7.0)
46
+ rspec-support (~> 3.8.0)
47
+ rspec-mocks (3.8.0)
48
48
  diff-lcs (>= 1.2.0, < 2.0)
49
- rspec-support (~> 3.7.0)
50
- rspec-support (3.7.1)
49
+ rspec-support (~> 3.8.0)
50
+ rspec-support (3.8.0)
51
51
  ruby_deep_clone (0.8.0)
52
52
  simplecov (0.16.1)
53
53
  docile (~> 1.1)
@@ -0,0 +1,25 @@
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) 2018, Ribose
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
  'using the BibliographicItem model'
17
17
 
18
18
  spec.homepage = 'https://github.com/riboseinc/isobib'
19
- spec.license = 'MIT'
19
+ spec.license = 'BSD-2-Clause'
20
20
 
21
21
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
22
22
  f.match(%r{^(test|spec|features)/})
@@ -22,14 +22,15 @@ module Isobib
22
22
 
23
23
  # @param code [String] the ISO standard Code to look up (e..g "ISO 9000")
24
24
  # @param year [String] the year the standard was published (optional)
25
- # @param opts [Hash] options; restricted to :all_parts if all-parts reference is required
25
+ # @param opts [Hash] options; restricted to :all_parts if all-parts reference is required,
26
+ # :keep_year if undated reference should return actual reference with year
26
27
  # @return [String] Relaton XML serialisation of reference
27
28
  def get(code, year, opts)
28
29
  return iev if code.casecmp('IEV') == 0
29
30
  code += '-1' if opts[:all_parts]
30
31
  ret = isobib_get1(code, year, opts)
31
32
  return nil if ret.nil?
32
- ret.to_most_recent_reference unless year
33
+ ret.to_most_recent_reference unless year || opts[:keep_year]
33
34
  ret.to_all_parts if opts[:all_parts]
34
35
  ret # .to_xml
35
36
  end
@@ -77,15 +78,13 @@ module Isobib
77
78
  []
78
79
  end
79
80
 
80
-
81
- def iev
81
+ def iev(code = "IEC 60050")
82
82
  IsoBibItem.from_xml(<<~"END")
83
83
  <bibitem type="international-standard" id="IEV">
84
- <title format="text/plain" language="en" script="Latn">Electropedia:
85
- The World's Online Electrotechnical Vocabulary</title>
84
+ <title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary</title>
86
85
  <link type="src">http://www.electropedia.org</link>
87
- <docidentifier>IEV</docidentifier>
88
- <date type="published"> <on>#{Date.today.year}</on> </date>
86
+ <docidentifier>#{code}</docidentifier>
87
+ <date type="published"><on>2011</on></date>
89
88
  <contributor>
90
89
  <role type="publisher"/>
91
90
  <organization>
@@ -98,7 +97,7 @@ module Isobib
98
97
  <script>Latn</script>
99
98
  <status> <stage>60</stage> </status>
100
99
  <copyright>
101
- <from>#{Date.today.year}</from>
100
+ <from>2018</from>
102
101
  <owner>
103
102
  <organization>
104
103
  <name>International Electrotechnical Commission</name>
@@ -107,11 +106,6 @@ module Isobib
107
106
  </organization>
108
107
  </owner>
109
108
  </copyright>
110
- <relation type="updates">
111
- <bibitem>
112
- <formattedref>IEC 60050</formattedref>
113
- </bibitem>
114
- </relation>
115
109
  </bibitem>
116
110
  END
117
111
  end
@@ -127,6 +121,7 @@ module Isobib
127
121
  missed_years = []
128
122
  result.each_slice(3) do |s| # ISO website only allows 3 connections
129
123
  fetch_pages(s, 3).each_with_index do |r, i|
124
+ next if r.nil?
130
125
  return { ret: r } if !year
131
126
  r.dates.select { |d| d.type == "published" }.each do |d|
132
127
  return { ret: r } if year.to_i == d.on.year
@@ -139,6 +134,7 @@ module Isobib
139
134
 
140
135
  def isobib_get1(code, year, opts)
141
136
  return iev if code.casecmp("IEV") == 0
137
+ return iev(code) if /^IEC 60050-/.match code
142
138
  result = isobib_search_filter(code) or return nil
143
139
  ret = isobib_results_filter(result, year)
144
140
  return ret[:ret] if ret[:ret]
@@ -26,7 +26,7 @@ module Isobib
26
26
  'TS' => 'technicalSpecification',
27
27
  'TR' => 'technicalReport',
28
28
  'PAS' => 'publiclyAvailableSpecification',
29
- 'AWI' => 'appruvedWorkItem',
29
+ 'AWI' => 'approvedWorkItem',
30
30
  'CD' => 'committeeDraft',
31
31
  'FDIS' => 'finalDraftInternationalStandard',
32
32
  'NP' => 'newProposal',
@@ -54,11 +54,12 @@ module Isobib
54
54
  # @return [Hash]
55
55
  # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
56
56
  def parse_page(hit_data)
57
+ return unless hit_data['path'].match(/\d+$/)
57
58
  doc, url = get_page "/standard/#{hit_data['path'].match(/\d+$/)}.html"
58
59
 
59
60
  # Fetch edition.
60
- edition = doc.xpath("//strong[contains(text(), 'Edition')]/..")
61
- .children.last.text.match(/\d+/).to_s
61
+ edition = doc&.xpath("//strong[contains(text(), 'Edition')]/..")
62
+ &.children&.last&.text&.match(/\d+/)&.to_s
62
63
 
63
64
  titles, abstract = fetch_titles_abstract(doc)
64
65
 
@@ -219,7 +220,7 @@ module Isobib
219
220
  url: 'www.iso.org',
220
221
  technical_committee: {
221
222
  name: wg_link.text + doc.css('div.entry-title')[0].text,
222
- type: 'technicalCommittee',
223
+ type: 'TC',
223
224
  number: workgroup[1]&.match(/\d+/)&.to_s&.to_i
224
225
  } }
225
226
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Isobib
4
- VERSION = '0.2.3'
4
+ VERSION = '0.2.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isobib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-09 00:00:00.000000000 Z
11
+ date: 2018-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -151,6 +151,7 @@ files:
151
151
  - CODE_OF_CONDUCT.md
152
152
  - Gemfile
153
153
  - Gemfile.lock
154
+ - LICENSE.txt
154
155
  - README.adoc
155
156
  - Rakefile
156
157
  - bin/bundle
@@ -177,7 +178,7 @@ files:
177
178
  - lib/relaton/processor.rb
178
179
  homepage: https://github.com/riboseinc/isobib
179
180
  licenses:
180
- - MIT
181
+ - BSD-2-Clause
181
182
  metadata: {}
182
183
  post_install_message:
183
184
  rdoc_options: []