relaton-ietf 0.6.0 → 0.6.1

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
  SHA1:
3
- metadata.gz: d1a02321969acca073a48c62ae75a320b3c522e7
4
- data.tar.gz: 275620cf52c41de79ef4cfc5e7757e510320c52e
3
+ metadata.gz: 4cc103e987a5910cf81abcb428e531a3dcb745d5
4
+ data.tar.gz: ac31349aa191b80af09bc3eb662dffb74856213e
5
5
  SHA512:
6
- metadata.gz: 104dad9c9bb3990c68d6a49391f623f99e1e8f20d173f6bbd914b9cff0767e3d91c4b9622f61e2504698d4501daf2c53c610a43fea76ca39c9cddae9c66aa4a8
7
- data.tar.gz: 00d29c43e3320f587518408c040e90158477ff5cc3fbc719debe01f50f1d0d51e8af8d716b8c686627ace940e15a458b96353602c07ed8b494f16028197034d2
6
+ metadata.gz: ca721460f6c4c69d8e771750bd974be8723676a22851676c7545280f22776ffc90d601b1ff1587afe4a694c3543e003af7db710b5cb524a7bc4e1b038e83536e
7
+ data.tar.gz: 6df64a75bffbe763747846d9978d5b935aa75885606963dd1060820f7a436f0c5f64319a28545b9b8c513b7543beed62b7e2cb85f55c653ca337edb835a77881
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- relaton-ietf (0.6.0)
5
- relaton-iso-bib (~> 0.3.0)
4
+ relaton-ietf (0.6.1)
5
+ relaton-bib (~> 0.3.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -21,7 +21,6 @@ GEM
21
21
  equivalent-xml (0.6.0)
22
22
  nokogiri (>= 1.4.3)
23
23
  hashdiff (0.4.0)
24
- isoics (0.1.7)
25
24
  json (2.2.0)
26
25
  method_source (0.9.2)
27
26
  mini_portile2 (2.4.0)
@@ -35,13 +34,9 @@ GEM
35
34
  pry (~> 0.10)
36
35
  public_suffix (3.1.1)
37
36
  rake (10.5.0)
38
- relaton-bib (0.3.0)
37
+ relaton-bib (0.3.2)
39
38
  addressable
40
39
  nokogiri (~> 1.10)
41
- relaton-iso-bib (0.3.0)
42
- isoics (~> 0.1.6)
43
- relaton-bib (~> 0.3.0)
44
- ruby_deep_clone (~> 0.8.0)
45
40
  rspec (3.8.0)
46
41
  rspec-core (~> 3.8.0)
47
42
  rspec-expectations (~> 3.8.0)
@@ -57,7 +52,6 @@ GEM
57
52
  rspec-support (3.8.2)
58
53
  ruby-debug-ide (0.7.0)
59
54
  rake (>= 0.8.1)
60
- ruby_deep_clone (0.8.0)
61
55
  safe_yaml (1.0.5)
62
56
  simplecov (0.17.0)
63
57
  docile (~> 1.1)
data/README.adoc CHANGED
@@ -128,6 +128,22 @@ item.to_xml bibdata: true
128
128
  ...
129
129
  ----
130
130
 
131
+ === Create bibliographic item form YAML
132
+ [source,ruby]
133
+ ----
134
+ hash = YAML.load_file 'spec/examples/ietf_bib_item.yml'
135
+ => {"id"=>"RFC 8341",
136
+ ...
137
+
138
+ bib_hash = RelatonIetf::HashConverter.hash_to_bib hash
139
+ => {:id=>"RFC 8341",
140
+ ...
141
+
142
+ RelatonIetf::IetfBibliographicItem.new bib_hash
143
+ => #<RelatonIetf::IetfBibliographicItem:0x007f9a929dde40
144
+ ...
145
+ ----
146
+
131
147
  == Contributing
132
148
 
133
149
  Bug reports and pull requests are welcome on GitHub at https://github.com/metanorma/relaton-ietf.
data/lib/relaton_ietf.rb CHANGED
@@ -4,6 +4,7 @@ require "relaton_ietf/version"
4
4
  require "relaton_ietf/ietf_bibliography"
5
5
  require "relaton_ietf/ietf_bibliographic_item"
6
6
  require "relaton_ietf/xml_parser"
7
+ require "relaton_ietf/hash_converter"
7
8
 
8
9
  if defined? Relaton
9
10
  require_relative "relaton/processor"
@@ -0,0 +1,23 @@
1
+ module RelatonIetf
2
+ class HashConverter < RelatonBib::HashConverter
3
+ class << self
4
+ # @override RelatonBib::HashConverter.hash_to_bib
5
+ # @param args [Hash]
6
+ # @param nested [TrueClass, FalseClass]
7
+ # @return [Hash]
8
+ # def hash_to_bib(args, nested = false)
9
+ # ret = super
10
+ # return if ret.nil?
11
+
12
+ # doctype_hash_to_bib(ret)
13
+ # ret
14
+ # end
15
+
16
+ # private
17
+
18
+ # def doctype_hash_to_bib(ret)
19
+ # ret
20
+ # end
21
+ end
22
+ end
23
+ end
@@ -4,13 +4,13 @@ module RelatonIetf
4
4
  attr_reader :doctype
5
5
 
6
6
  # @return [Array<String>]
7
- attr_reader :keywords
7
+ attr_reader :keyword
8
8
 
9
9
  # @param doctype [String]
10
- # @param keywords [Array<String>]
10
+ # @param keyword [Array<String>]
11
11
  def initialize(**args)
12
12
  @doctype = args.delete :doctype
13
- @keywords = args.delete(:keywords) || []
13
+ @keyword = args.delete(:keyword) || []
14
14
  super
15
15
  end
16
16
 
@@ -23,7 +23,7 @@ module RelatonIetf
23
23
  if opts[:bibdata]
24
24
  b.ext do
25
25
  b.doctype doctype if doctype
26
- keywords.each { |k| b.keyword k }
26
+ keyword.each { |k| b.keyword k }
27
27
  end
28
28
  end
29
29
  end
@@ -54,7 +54,7 @@ module RelatonIetf
54
54
  contributor: contributors(reference),
55
55
  date: dates(reference),
56
56
  series: series(reference),
57
- keywords: reference.xpath("front/keyword").map(&:text),
57
+ keyword: reference.xpath("front/keyword").map(&:text),
58
58
  )
59
59
  end
60
60
  # rubocop:enable Metrics/MethodLength
@@ -112,9 +112,9 @@ module RelatonIetf
112
112
  res.body
113
113
  end
114
114
 
115
- def make_uri(uri_template, reference)
116
- uri_template.gsub("CODE", reference)
117
- end
115
+ # def make_uri(uri_template, reference)
116
+ # uri_template.gsub("CODE", reference)
117
+ # end
118
118
 
119
119
  # @return [String]
120
120
  def language(reference)
@@ -160,7 +160,7 @@ module RelatonIetf
160
160
  next unless si[:stream]
161
161
 
162
162
  entity = RelatonBib::Organization.new name: si[:stream]
163
- { entity: entity, role: ["author"] }
163
+ { entity: entity, role: [type: "author"] }
164
164
  end.compact
165
165
  end
166
166
 
@@ -226,9 +226,9 @@ module RelatonIetf
226
226
  end
227
227
 
228
228
  # @param author [Nokogiri::XML::Document]
229
- # @return [String]
229
+ # @return [Hash]
230
230
  def contributor_role(author)
231
- author[:role] || "author"
231
+ { type: author[:role] || "author" }
232
232
  end
233
233
 
234
234
  def month(mon)
@@ -260,7 +260,7 @@ module RelatonIetf
260
260
  id = (reference[:anchor] || reference[:docName]).sub(/^(RFC)/, "\\1 ")
261
261
  ret = []
262
262
  ret << RelatonBib::DocumentIdentifier.new(type: "IETF", id: id)
263
- ret + reference.xpath("./seriesinfo").map do |si|
263
+ ret + reference.xpath("./seriesInfo").map do |si|
264
264
  next unless si[:name] == "DOI"
265
265
 
266
266
  RelatonBib::DocumentIdentifier.new(id: si[:value], type: si[:name])
@@ -1,3 +1,3 @@
1
1
  module RelatonIetf
2
- VERSION = "0.6.0".freeze
2
+ VERSION = "0.6.1".freeze
3
3
  end
data/relaton_ietf.gemspec CHANGED
@@ -40,5 +40,5 @@ Gem::Specification.new do |spec|
40
40
  spec.add_development_dependency "vcr"
41
41
  spec.add_development_dependency "webmock"
42
42
 
43
- spec.add_dependency "relaton-iso-bib", "~> 0.3.0"
43
+ spec.add_dependency "relaton-bib", "~> 0.3.0"
44
44
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-ietf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
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-07-24 00:00:00.000000000 Z
11
+ date: 2019-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -151,7 +151,7 @@ dependencies:
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  - !ruby/object:Gem::Dependency
154
- name: relaton-iso-bib
154
+ name: relaton-bib
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - "~>"
@@ -188,6 +188,7 @@ files:
188
188
  - lib/relaton/processor.rb
189
189
  - lib/relaton/provider_ietf.rb
190
190
  - lib/relaton_ietf.rb
191
+ - lib/relaton_ietf/hash_converter.rb
191
192
  - lib/relaton_ietf/ietf_bibliographic_item.rb
192
193
  - lib/relaton_ietf/ietf_bibliography.rb
193
194
  - lib/relaton_ietf/scrapper.rb