relaton-iho 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,41 @@
1
+ require "relaton/processor"
2
+
3
+ module RelatonIho
4
+ class Processor < Relaton::Processor
5
+ attr_reader :idtype
6
+
7
+ def initialize
8
+ @short = :relaton_iho
9
+ @prefix = "IHO"
10
+ @defaultprefix = %r{^IHO\s}
11
+ @idtype = "IHO"
12
+ end
13
+
14
+ # @param code [String]
15
+ # @param date [String, NilClass] year
16
+ # @param opts [Hash]
17
+ # @return [RelatonIho::IhoBibliographicItem]
18
+ def get(code, date, opts)
19
+ ::RelatonIho::IhoBibliography.get(code, date, opts)
20
+ end
21
+
22
+ # @param xml [String]
23
+ # @return [RelatonIho::IhoBibliographicItem]
24
+ def from_xml(xml)
25
+ ::RelatonIho::XMLParser.from_xml xml
26
+ end
27
+
28
+ # @param hash [Hash]
29
+ # @return [RelatonIho::IhoBibliographicItem]
30
+ def hash_to_bib(hash)
31
+ item_hash = ::RelatonIho::HashConverter.hash_to_bib(hash)
32
+ ::RelatonIho::IhoBibliographicItem.new item_hash
33
+ end
34
+
35
+ # Returns hash of XML grammar
36
+ # @return [String]
37
+ def grammar_hash
38
+ @grammar_hash ||= ::RelatonIeee.grammar_hash
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,3 @@
1
+ module RelatonIho
2
+ VERSION = "1.2.0".freeze
3
+ end
@@ -0,0 +1,45 @@
1
+ module RelatonIho
2
+ class XMLParser < RelatonBib::XMLParser
3
+ class << self
4
+ private
5
+
6
+ # Override RelatonBib::XMLParser.item_data method.
7
+ # @param item [Nokogiri::XML::Element]
8
+ # @returtn [Hash]
9
+ def item_data(item)
10
+ data = super
11
+ ext = item.at "./ext"
12
+ return data unless ext
13
+
14
+ data[:commentperiod] = fetch_commentperiond ext
15
+ data
16
+ end
17
+
18
+ # @param item_hash [Hash]
19
+ # @return [RelatonIho::IhoBibliographicItem]
20
+ def bib_item(item_hash)
21
+ IhoBibliographicItem.new item_hash
22
+ end
23
+
24
+ # @param ext [Nokogiri::XML::Element]
25
+ # @return [RelatonIho::EditorialGroupCollection, nil]
26
+ def fetch_editorialgroup(ext)
27
+ return unless ext
28
+
29
+ egs = ext.xpath("editorialgroup").map do |eg|
30
+ EditorialGroup.new(committee: eg.at("committee")&.text,
31
+ workgroup: eg.at("workgroup")&.text)
32
+ end
33
+ EditorialGroupCollection.new egs if egs.any?
34
+ end
35
+
36
+ # @param ext [Nokogiri::XML::Element]
37
+ # @return [RelatonIho::CommentPeriod, nil]
38
+ def fetch_commentperiond(ext)
39
+ return unless ext && (cp = ext.at "commentperiod")
40
+
41
+ CommentPeriond.new from: cp.at("from")&.text, to: cp.at("to")&.text
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,36 @@
1
+ lib = File.expand_path("lib", __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "relaton_iho/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "relaton-iho"
7
+ s.version = RelatonIho::VERSION
8
+ s.authors = ["Ribose Inc."]
9
+ s.email = ["open.source@ribose.com"]
10
+ s.homepage = "https://github.com/relaton/relaton-iho"
11
+ s.licenses = "BSD-2-Clause"
12
+ s.summary = "RelatonIho: retrieve IHO Standards for bibliographic "\
13
+ "using the BibliographicItem model"
14
+ s.description = "RelatonIho: retrieve IHO Standards for bibliographic "\
15
+ "using the BibliographicItem model"
16
+
17
+ s.files = Dir.chdir(File.expand_path(__dir__)) do
18
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ end
20
+ s.platform = Gem::Platform::RUBY
21
+ s.require_paths = ["lib"]
22
+ s.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
23
+
24
+ s.add_development_dependency "byebug"
25
+ s.add_development_dependency "debase"
26
+ s.add_development_dependency "equivalent-xml", "~> 0.6"
27
+ s.add_development_dependency "rake", "~> 10.0"
28
+ s.add_development_dependency "rspec", "~> 3.0"
29
+ s.add_development_dependency "ruby-debug-ide"
30
+ s.add_development_dependency "ruby-jing"
31
+ s.add_development_dependency "simplecov"
32
+ s.add_development_dependency "vcr"
33
+ s.add_development_dependency "webmock"
34
+
35
+ s.add_dependency "relaton-bib", "~> 1.2.0"
36
+ end
metadata ADDED
@@ -0,0 +1,225 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: relaton-iho
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Ribose Inc.
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-06-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: byebug
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: debase
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: equivalent-xml
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.6'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: ruby-debug-ide
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: ruby-jing
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: vcr
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: webmock
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: relaton-bib
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 1.2.0
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 1.2.0
167
+ description: 'RelatonIho: retrieve IHO Standards for bibliographic using the BibliographicItem
168
+ model'
169
+ email:
170
+ - open.source@ribose.com
171
+ executables: []
172
+ extensions: []
173
+ extra_rdoc_files: []
174
+ files:
175
+ - ".github/workflows/macos.yml"
176
+ - ".github/workflows/ubuntu.yml"
177
+ - ".github/workflows/windows.yml"
178
+ - ".gitignore"
179
+ - ".rspec"
180
+ - ".rubocop.yml"
181
+ - Gemfile
182
+ - README.adoc
183
+ - Rakefile
184
+ - bin/rspec
185
+ - grammars/basicdoc.rng
186
+ - grammars/biblio.rng
187
+ - grammars/iho.rng
188
+ - grammars/isodoc.rng
189
+ - grammars/reqt.rng
190
+ - lib/relaton_iho.rb
191
+ - lib/relaton_iho/comment_periond.rb
192
+ - lib/relaton_iho/editorial_group.rb
193
+ - lib/relaton_iho/hash_converter.rb
194
+ - lib/relaton_iho/hit_collection.rb
195
+ - lib/relaton_iho/iho_bibliographic_item.rb
196
+ - lib/relaton_iho/iho_bibliography.rb
197
+ - lib/relaton_iho/processor.rb
198
+ - lib/relaton_iho/version.rb
199
+ - lib/relaton_iho/xml_parser.rb
200
+ - relaton_iho.gemspec
201
+ homepage: https://github.com/relaton/relaton-iho
202
+ licenses:
203
+ - BSD-2-Clause
204
+ metadata: {}
205
+ post_install_message:
206
+ rdoc_options: []
207
+ require_paths:
208
+ - lib
209
+ required_ruby_version: !ruby/object:Gem::Requirement
210
+ requirements:
211
+ - - ">="
212
+ - !ruby/object:Gem::Version
213
+ version: 2.4.0
214
+ required_rubygems_version: !ruby/object:Gem::Requirement
215
+ requirements:
216
+ - - ">="
217
+ - !ruby/object:Gem::Version
218
+ version: '0'
219
+ requirements: []
220
+ rubygems_version: 3.0.6
221
+ signing_key:
222
+ specification_version: 4
223
+ summary: 'RelatonIho: retrieve IHO Standards for bibliographic using the BibliographicItem
224
+ model'
225
+ test_files: []