isobib 0.3.1 → 0.4.0

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: 64c73a00ef0f10f6c53dbb601cc5eb8b947c86be7de4201400201443bc83b06f
4
- data.tar.gz: e86135b785a8c68b684261dd061508a9be8c7731b40f9d98295fd9c201c7e28d
3
+ metadata.gz: 7851c423e4bc7ce5b9458d963fd83e349c13390cf27a2e3d6cc953c7cd79be77
4
+ data.tar.gz: bd8d76b7b837508fde36e62d33dc1a6ae89d03f1227497f9cbac98c3e593370e
5
5
  SHA512:
6
- metadata.gz: 4708293a8131415f1e97d4e4e6b0b5dac524726d319cf4638c0e957bc228d8538d5ba2da773594bb9e191e36b38e8ca604da1b49be59f92ea7e7a5107eaa7a76
7
- data.tar.gz: 0763bff478f04f86333bdebe4e2c5f8608c6bd368d83fc688c7fed3564f301db3ddc9a3a246271baa3e2b1bf89abd5f76ef3904df3970f27ff65a1a288045601
6
+ metadata.gz: ba666c143d7d7246d9e12ac8a8d727b9cd628fbde411eefd58f3a000774275edaaa04ed705f32123276ef5dd62369e46065e9b039a5de77018774a40e1767007
7
+ data.tar.gz: 0e99131a0abf469ea2e2fc7acf061a9ff84e5005666315516a0ce70c91739136c90a14e49702056b5e6346afaed062c3d84b7d5b099a09f95038165170a41a96
@@ -1,13 +1,16 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- isobib (0.3.1)
4
+ isobib (0.4.0)
5
5
  algoliasearch
6
- iso-bib-item (~> 0.3.0)
6
+ iecbib (~> 0.2.0)
7
+ iso-bib-item (~> 0.4.0)
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
10
11
  specs:
12
+ addressable (2.5.2)
13
+ public_suffix (>= 2.0.2, < 4.0)
11
14
  algoliasearch (1.23.2)
12
15
  httpclient (~> 2.8, >= 2.8.3)
13
16
  json (>= 1.5.1)
@@ -18,7 +21,10 @@ GEM
18
21
  equivalent-xml (0.6.0)
19
22
  nokogiri (>= 1.4.3)
20
23
  httpclient (2.8.3)
21
- iso-bib-item (0.3.0)
24
+ iecbib (0.2.0)
25
+ addressable
26
+ iso-bib-item (~> 0.4.0)
27
+ iso-bib-item (0.4.0)
22
28
  isoics (~> 0.1.6)
23
29
  nokogiri (~> 1.8.4)
24
30
  ruby_deep_clone (~> 0.8.0)
@@ -26,7 +32,7 @@ GEM
26
32
  json (2.1.0)
27
33
  method_source (0.9.0)
28
34
  mini_portile2 (2.3.0)
29
- nokogiri (1.8.4)
35
+ nokogiri (1.8.5)
30
36
  mini_portile2 (~> 2.3.0)
31
37
  pry (0.11.3)
32
38
  coderay (~> 1.1.0)
@@ -34,6 +40,7 @@ GEM
34
40
  pry-byebug (3.6.0)
35
41
  byebug (~> 10.0)
36
42
  pry (~> 0.10)
43
+ public_suffix (3.0.3)
37
44
  rake (10.5.0)
38
45
  rspec (3.8.0)
39
46
  rspec-core (~> 3.8.0)
@@ -41,7 +48,7 @@ GEM
41
48
  rspec-mocks (~> 3.8.0)
42
49
  rspec-core (3.8.0)
43
50
  rspec-support (~> 3.8.0)
44
- rspec-expectations (3.8.1)
51
+ rspec-expectations (3.8.2)
45
52
  diff-lcs (>= 1.2.0, < 2.0)
46
53
  rspec-support (~> 3.8.0)
47
54
  rspec-mocks (3.8.0)
@@ -69,4 +76,4 @@ DEPENDENCIES
69
76
  simplecov
70
77
 
71
78
  BUNDLED WITH
72
- 1.16.2
79
+ 1.16.6
@@ -34,5 +34,6 @@ Gem::Specification.new do |spec|
34
34
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
35
35
 
36
36
  spec.add_dependency 'algoliasearch'
37
- spec.add_dependency 'iso-bib-item', '~> 0.3.0'
37
+ spec.add_dependency 'iso-bib-item', '~> 0.4.0'
38
+ spec.add_dependency 'iecbib', '~> 0.2.0'
38
39
  end
@@ -3,6 +3,7 @@
3
3
  # require 'isobib/iso_bibliographic_item'
4
4
  require 'isobib/scrapper'
5
5
  require 'isobib/hit_pages'
6
+ require 'iecbib'
6
7
 
7
8
  module Isobib
8
9
  # Class methods for search ISO standards.
@@ -26,13 +27,13 @@ module Isobib
26
27
  # :keep_year if undated reference should return actual reference with year
27
28
  # @return [String] Relaton XML serialisation of reference
28
29
  def get(code, year, opts)
29
- return iev if code.casecmp('IEV') == 0
30
30
  code += '-1' if opts[:all_parts]
31
+ return Iecbib::IecBibliography.get(code, year, opts) if %r[^ISO/IEC DIR].match code
31
32
  ret = isobib_get1(code, year, opts)
32
33
  return nil if ret.nil?
33
34
  ret.to_most_recent_reference unless year || opts[:keep_year]
34
35
  ret.to_all_parts if opts[:all_parts]
35
- ret # .to_xml
36
+ ret
36
37
  end
37
38
 
38
39
  private
@@ -78,39 +79,6 @@ module Isobib
78
79
  []
79
80
  end
80
81
 
81
- def iev(code = "IEC 60050")
82
- IsoBibItem.from_xml(<<~"END")
83
- <bibitem type="international-standard" id="IEV">
84
- <title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary</title>
85
- <link type="src">http://www.electropedia.org</link>
86
- <docidentifier>#{code}:2011</docidentifier>
87
- <date type="published"><on>2011</on></date>
88
- <contributor>
89
- <role type="publisher"/>
90
- <organization>
91
- <name>International Electrotechnical Commission</name>
92
- <abbreviation>IEC</abbreviation>
93
- <uri>www.iec.ch</uri>
94
- </organization>
95
- </contributor>
96
- <language>en</language> <language>fr</language>
97
- <script>Latn</script>
98
- <status> <stage>60</stage> </status>
99
- <copyright>
100
- <from>2018</from>
101
- <owner>
102
- <organization>
103
- <name>International Electrotechnical Commission</name>
104
- <abbreviation>IEC</abbreviation>
105
- <uri>www.iec.ch</uri>
106
- </organization>
107
- </owner>
108
- </copyright>
109
- </bibitem>
110
- END
111
- end
112
-
113
-
114
82
  # Sort through the results from Isobib, fetching them three at a time,
115
83
  # and return the first result that matches the code,
116
84
  # matches the year (if provided), and which # has a title (amendments do not).
@@ -133,8 +101,7 @@ module Isobib
133
101
  end
134
102
 
135
103
  def isobib_get1(code, year, opts)
136
- return iev if code.casecmp("IEV") == 0
137
- return iev(code) if /^IEC 60050-/.match code
104
+ # return iev(code) if /^IEC 60050-/.match code
138
105
  result = isobib_search_filter(code) or return nil
139
106
  ret = isobib_results_filter(result, year)
140
107
  return ret[:ret] if ret[:ret]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Isobib
4
- VERSION = '0.3.1'
4
+ VERSION = '0.4.0'
5
5
  end
@@ -7,13 +7,17 @@ module Relaton
7
7
  def initialize
8
8
  @short = :isobib
9
9
  @prefix = "ISO"
10
- @defaultprefix = %r{^(ISO)[ /]|^IEV($| )|^IEC 60050}
10
+ @defaultprefix = %r{^(ISO)[ /]}
11
11
  @idtype = "ISO"
12
12
  end
13
13
 
14
14
  def get(code, date, opts)
15
15
  ::Isobib::IsoBibliography.get(code, date, opts)
16
16
  end
17
+
18
+ def from_xml(xml)
19
+ IsoBibItem::XMLParser.from_xml xml
20
+ end
17
21
  end
18
22
  end
19
23
  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.3.1
4
+ version: 0.4.0
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-09-10 00:00:00.000000000 Z
11
+ date: 2018-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -128,14 +128,28 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 0.3.0
131
+ version: 0.4.0
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 0.3.0
138
+ version: 0.4.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: iecbib
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 0.2.0
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 0.2.0
139
153
  description: 'IsoBib: retrieve ISO Standards for bibliographic use using the BibliographicItem
140
154
  model'
141
155
  email: