relaton-bib 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 65c51ca68b9b7e8e30e43b00179e575bdbbd770d8383961981ea0f8db8eef246
4
- data.tar.gz: 38f8fbea59cafbfdd93279d37752113866ee499750c4ce83b16967081adcc268
3
+ metadata.gz: 5dd4730cb860ea6fea05b214a89a7e180acca7cebdfde515924cff5cbc006631
4
+ data.tar.gz: c71b46fefb288fdc2b3e51122d793cd225431bd5818aad704bbf78dfc8aa36c0
5
5
  SHA512:
6
- metadata.gz: 13aa247e35a2e39ed6225c3763a666e7a35ce7682fab8dcbfbeb6a4a379d177bf9fcfd6462e7bdf4366d6d10ae164a64b03c8003862c774397f4636f54b514fa
7
- data.tar.gz: 980bb1bead0c1f5f39d816ede82ba7596ab7536107fc9ec01e631574eb870f0e17153a5684cca6f7ff4b13d1dd5cd192be81513702f9cad8abce090096ce66f7
6
+ metadata.gz: 22616fba5d4a2a502b2f969efacb00a8384e94d69b75147687ea0f086019d1614db7e5393c6b4d2e7ea5eb336332c5a208690ddda0bdd1593ed29b344a48d049
7
+ data.tar.gz: f2d074312be6ed3194b08dc0b6e5cc2eb6b269216d1b0500b072fb6868b66e47d09fa21abfc5dd43cf2e22fdb82fd948c0597526fec64da5c8ee2e8dc4ae6c85
@@ -171,7 +171,7 @@ module RelatonBib
171
171
  # @option link [String] :content
172
172
  def initialize(**args)
173
173
  if args[:type] && !TYPES.include?(args[:type])
174
- warn %{Document type "#{args[:type]}" is invalid.}
174
+ warn %{[relaton-bib] document type "#{args[:type]}" is invalid.}
175
175
  end
176
176
 
177
177
  @title = (args[:title] || []).map do |t|
@@ -41,7 +41,8 @@ module RelatonBib
41
41
  # @param [Nokogiri::XML::Builder] builder
42
42
  #
43
43
  def to_xml(builder)
44
- builder.docidentifier(id, type: type)
44
+ element = builder.docidentifier id
45
+ element[:type] = type if type
45
46
  end
46
47
 
47
48
  # @return [Hash]
@@ -39,7 +39,7 @@ module RelatonBib
39
39
 
40
40
  builder.parent["language"] = language.join(",") if language&.any?
41
41
  builder.parent["script"] = script.join(",") if script&.any?
42
- builder.text content
42
+ builder.text content.encode(xml: :text)
43
43
  end
44
44
 
45
45
  # @return [Hash]
@@ -6,7 +6,7 @@ module RelatonBib
6
6
  # @return [Symbol] :src/:obp/:rss
7
7
  attr_reader :type
8
8
  # @retutn [URI]
9
- attr_accessor :content
9
+ attr_reader :content
10
10
 
11
11
  # @param type [String] src/obp/rss
12
12
  # @param content [String]
@@ -15,6 +15,11 @@ module RelatonBib
15
15
  @content = Addressable::URI.parse content if content
16
16
  end
17
17
 
18
+ # @parma url [String]
19
+ def content=(url)
20
+ @content = Addressable::URI.parse url
21
+ end
22
+
18
23
  # @param builder [Nokogiri::XML::Builder]
19
24
  def to_xml(builder)
20
25
  builder.uri(content.to_s, type: type)
@@ -1,3 +1,3 @@
1
1
  module RelatonBib
2
- VERSION = "0.5.1".freeze
2
+ VERSION = "0.5.2".freeze
3
3
  end
@@ -168,12 +168,12 @@ module RelatonBib
168
168
  end
169
169
 
170
170
  def fetch_dates(item)
171
- item.xpath("./date").map do |d|
171
+ item.xpath("./date").reduce([]) do |a, d|
172
172
  type = d[:type].to_s.empty? ? "published" : d[:type]
173
173
  if (on = d.at("on"))
174
- RelatonBib::BibliographicDate.new(type: type, on: on.text, to: d.at("to")&.text)
175
- elsif (from = d.at{"from"})
176
- RelatonBib::BibliographicDate.new(type: type, from: from.text, to: d.at("to")&.text)
174
+ a << RelatonBib::BibliographicDate.new(type: type, on: on.text, to: d.at("to")&.text)
175
+ elsif (from = d.at("from"))
176
+ a << RelatonBib::BibliographicDate.new(type: type, from: from.text, to: d.at("to")&.text)
177
177
  end
178
178
  end
179
179
  end
data/relaton-bib.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
 
11
11
  spec.summary = "RelatonBib: Ruby XMLDOC impementation."
12
12
  spec.description = "RelatonBib: Ruby XMLDOC impementation."
13
- spec.homepage = "https://github.com/relaton/relaton-item"
13
+ spec.homepage = "https://github.com/relaton/relaton-bib"
14
14
  spec.license = "BSD-2-Clause"
15
15
 
16
16
  # Specify which files should be added to the gem when it is released.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-bib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-30 00:00:00.000000000 Z
11
+ date: 2020-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debase
@@ -193,7 +193,6 @@ files:
193
193
  - ".rspec"
194
194
  - ".rubocop.yml"
195
195
  - Gemfile
196
- - Gemfile.lock
197
196
  - LICENSE.txt
198
197
  - README.adoc
199
198
  - Rakefile
@@ -235,7 +234,7 @@ files:
235
234
  - lib/relaton_bib/workers_pool.rb
236
235
  - lib/relaton_bib/xml_parser.rb
237
236
  - relaton-bib.gemspec
238
- homepage: https://github.com/relaton/relaton-item
237
+ homepage: https://github.com/relaton/relaton-bib
239
238
  licenses:
240
239
  - BSD-2-Clause
241
240
  metadata: {}