gbbib 0.2.2 → 0.2.3

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: b3e3ee80ed7fef30b07a956b8ec13313615c0e164ac523824fff69e63850539f
4
- data.tar.gz: 9a753e31b51f631f710f96d3f38ba6bff254980f4faa5ed51571288acf5dc40d
3
+ metadata.gz: 6b003d92490a9a1c6bc3ae124b2c315232336f57fd113ddeb0edc5a1cc3aab83
4
+ data.tar.gz: 5f75e05b76700d7901af1cbde25be569a2519c196b4e6753c8e8d82b2dee5b8e
5
5
  SHA512:
6
- metadata.gz: c5ed82a9de4bb8cf57de8d5271f0e3de47f64496509581600dc2f398e64042adc621f2a3ac3ff5321f11bddfea5ac5b5a11c9dca35ae642e702de8fc7624e5b4
7
- data.tar.gz: 21954b24468a3ea22ad0db05b606be95b37a19e1dae13d35d9ce2a766ba212366978f35d3991bb24b6d403bb8cc26c9d7c7bdbc0477c58c1d760839b5e01d03d
6
+ metadata.gz: 236ebaf149fdfd887f88109f6941c11e29b826a5d25763fdd0e100e438c6b2244c162197de20c2f049d290e75b86339b2e0c50526fcd98095b5b5d910e2079a6
7
+ data.tar.gz: 63fc93e2558e790221d96fd367c30d009798d0b4971049e342d85475a71ae20a5b97e78e6c94d7c3a4d5ab9588b88e90c87c049dee5168450860cdf84c527bbc
data/Gemfile.lock CHANGED
@@ -10,18 +10,18 @@ GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
12
  byebug (10.0.2)
13
- cnccs (0.1.2)
13
+ cnccs (0.1.3)
14
14
  coderay (1.1.2)
15
15
  diff-lcs (1.3)
16
16
  docile (1.3.1)
17
17
  equivalent-xml (0.6.0)
18
18
  nokogiri (>= 1.4.3)
19
- gb-agencies (0.0.1)
20
- iso-bib-item (0.2.3)
19
+ gb-agencies (0.0.3)
20
+ iso-bib-item (0.2.5)
21
21
  isoics (~> 0.1.6)
22
22
  nokogiri (~> 1.8.4)
23
23
  ruby_deep_clone (~> 0.8.0)
24
- isoics (0.1.6)
24
+ isoics (0.1.7)
25
25
  json (2.1.0)
26
26
  method_source (0.9.0)
27
27
  mini_portile2 (2.3.0)
@@ -34,19 +34,19 @@ GEM
34
34
  byebug (~> 10.0)
35
35
  pry (~> 0.10)
36
36
  rake (10.5.0)
37
- rspec (3.7.0)
38
- rspec-core (~> 3.7.0)
39
- rspec-expectations (~> 3.7.0)
40
- rspec-mocks (~> 3.7.0)
41
- rspec-core (3.7.1)
42
- rspec-support (~> 3.7.0)
43
- rspec-expectations (3.7.0)
37
+ rspec (3.8.0)
38
+ rspec-core (~> 3.8.0)
39
+ rspec-expectations (~> 3.8.0)
40
+ rspec-mocks (~> 3.8.0)
41
+ rspec-core (3.8.0)
42
+ rspec-support (~> 3.8.0)
43
+ rspec-expectations (3.8.1)
44
44
  diff-lcs (>= 1.2.0, < 2.0)
45
- rspec-support (~> 3.7.0)
46
- rspec-mocks (3.7.0)
45
+ rspec-support (~> 3.8.0)
46
+ rspec-mocks (3.8.0)
47
47
  diff-lcs (>= 1.2.0, < 2.0)
48
- rspec-support (~> 3.7.0)
49
- rspec-support (3.7.1)
48
+ rspec-support (~> 3.8.0)
49
+ rspec-support (3.8.0)
50
50
  ruby_deep_clone (0.8.0)
51
51
  simplecov (0.16.1)
52
52
  docile (~> 1.1)
data/LICENSE.txt CHANGED
@@ -1,21 +1,25 @@
1
- The MIT License (MIT)
1
+ BSD 2-Clause License
2
2
 
3
- Copyright (c) 2018 Andrei Kislichenko
3
+ Copyright (c) 2018, Ribose
4
+ All rights reserved.
4
5
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
11
8
 
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
9
+ * Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
14
11
 
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
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.
data/gbbib.gemspec CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.description = 'GdBib: retrieve Chinese GB Standards for bibliographic'\
15
15
  ' use using the BibliographicItem model.'
16
16
  spec.homepage = 'https://github.com/riboseinc/gdbib'
17
- spec.license = 'MIT'
17
+ spec.license = 'BSD-2-Clause'
18
18
 
19
19
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
20
20
  f.match(%r{^(test|spec|features)/})
@@ -58,11 +58,12 @@ module Gbbib
58
58
  inspect
59
59
  end
60
60
 
61
- def id(attribute, delim = '')
61
+ def makeid(id, attribute, delim = '')
62
62
  return nil if attribute && !@id_attribute
63
- idstr = "#{@docidentifier.prefix}#{delim}#{@docidentifier.project_number}"
64
- if @docidentifier.part_number&.size&.positive?
65
- idstr = idstr + "-#{@docidentifier.part_number}"
63
+ id = @docidentifier.reject { |i| i.type == "DOI" }[0] unless id
64
+ idstr = id.project_number.to_s
65
+ if id.part_number&.size&.positive?
66
+ idstr = idstr + "-#{id.part_number}"
66
67
  end
67
68
  idstr.strip
68
69
  end
@@ -39,7 +39,6 @@ module Gbbib
39
39
  # @param opts [Hash] options; restricted to :all_parts if all-parts reference is required
40
40
  # @return [String] Relaton XML serialisation of reference
41
41
  def get(code, year, opts)
42
- return iev.to_xml if code.casecmp('IEV') == 0
43
42
  code += '.1' if opts[:all_parts]
44
43
  ret = get1(code, year, opts)
45
44
  return nil if ret.nil?
@@ -68,7 +67,6 @@ module Gbbib
68
67
  end
69
68
 
70
69
  def get1(code, year, opts)
71
- return iev if code.casecmp("IEV") == 0
72
70
  result = search_filter(code) or return nil
73
71
  ret = results_filter(result, year)
74
72
  return ret[:ret] if ret[:ret]
@@ -115,42 +113,6 @@ module Gbbib
115
113
  workers.end
116
114
  workers.result.sort { |x, y| x[:i] <=> y[:i] }.map { |x| x[:hit] }
117
115
  end
118
-
119
- def iev
120
- Nokogiri::XML.fragment(<<~"END")
121
- <bibitem type="international-standard" id="IEV">
122
- <title format="text/plain" language="en" script="Latn">Electropedia: The World's Online Electrotechnical Vocabulary</title>
123
- <source type="src">http://www.electropedia.org</source>
124
- <docidentifier>IEV</docidentifier>
125
- <date type="published"> <on>#{Date.today.year}</on> </date>
126
- <contributor>
127
- <role type="publisher"/>
128
- <organization>
129
- <name>International Electrotechnical Commission</name>
130
- <abbreviation>IEC</abbreviation>
131
- <uri>www.iec.ch</uri>
132
- </organization>
133
- </contributor>
134
- <language>en</language> <language>fr</language>
135
- <script>Latn</script>
136
- <copyright>
137
- <from>#{Date.today.year}</from>
138
- <owner>
139
- <organization>
140
- <name>International Electrotechnical Commission</name>
141
- <abbreviation>IEC</abbreviation>
142
- <uri>www.iec.ch</uri>
143
- </organization>
144
- </owner>
145
- </copyright>
146
- <relation type="updates">
147
- <bibitem>
148
- <formattedref>IEC 60050</formattedref>
149
- </bibitem>
150
- </relation>
151
- </bibitem>
152
- END
153
- end
154
116
  end
155
117
  end
156
118
  end
@@ -37,9 +37,9 @@ module Gbbib
37
37
  # * :project_number [String]
38
38
  # * :part_number [String]
39
39
  def get_docid(doc, xpt = '//dt[text()="标准号"]/following-sibling::dd[1]')
40
- item_ref = doc.xpath(xpt).text.match(/(?<=\s)(\d+)\.?((?<=\.)\d+|)/)
41
- prefix = doc.xpath(xpt).text.match(/^[^\s]+/).to_s
42
- { project_number: item_ref[1], part_number: item_ref[2], prefix: prefix }
40
+ item_ref = doc.xpath(xpt).text.match(/^([^–—.-]*\d+)\.?((?<=\.)\d+|)/)
41
+ #prefix = doc.xpath(xpt).text.match(/^[^\s]+/).to_s
42
+ { project_number: item_ref[1], part_number: item_ref[2], prefix: nil }
43
43
  end
44
44
 
45
45
  def get_contributors(doc, xpt = '//dt[text()="标准号"]/following-sibling::dd[1]')
data/lib/gbbib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gbbib
4
- VERSION = '0.2.2'
4
+ VERSION = '0.2.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gbbib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
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-01 00:00:00.000000000 Z
11
+ date: 2018-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -173,7 +173,7 @@ files:
173
173
  - lib/relaton/processor.rb
174
174
  homepage: https://github.com/riboseinc/gdbib
175
175
  licenses:
176
- - MIT
176
+ - BSD-2-Clause
177
177
  metadata: {}
178
178
  post_install_message:
179
179
  rdoc_options: []