iso-bib-item 0.1.3 → 0.1.4

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: cac69459bad2df02265258444d48c83cc6317cef
4
- data.tar.gz: 6a0da96b385ab8c522ce3b894fd6237a4202a361
3
+ metadata.gz: 59ade325759b72b547cb68792cd68fb87acf8671
4
+ data.tar.gz: c8c7b6428d783a3481ea23ffcec25e94d22c8cda
5
5
  SHA512:
6
- metadata.gz: b93fed3b7e43f7150469bc0c8ea30699c67927e8b4a6afba7bccbdabb8bb42fc3c217ea2e73a77ecbbf0251bf0ea1aa3ec3a20b735623222d16ea3c017469a19
7
- data.tar.gz: 8ec4a1a29f6969020fa45dff5d529f61a9223bf4a2819da2492aa883bd584a97422129372290191cab6aed59255852d771c97e7042931c824a45eef7f38489c0
6
+ metadata.gz: bba1fe703f87d03747303659283786f0830ec273b5c35475bce558ba8bd497b3e13a83c1a8979a7d80a36aa41bbb7c401cbecef553154ab4281873faba0d851d
7
+ data.tar.gz: 886fb4844ca6477f3ea90c1b060df0ab3fc28a1a3af29baa95c195714fae4c3e08857bd16299a41e57d6bf3d1a45e5ca33d12bf1a9517f15ec5d33978392bc91
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- iso-bib-item (0.1.1)
5
- isoics
4
+ iso-bib-item (0.1.4)
5
+ isoics (~> 0.1.6)
6
6
  nokogiri
7
7
 
8
8
  GEM
@@ -12,7 +12,7 @@ GEM
12
12
  coderay (1.1.2)
13
13
  diff-lcs (1.3)
14
14
  docile (1.3.0)
15
- isoics (0.1.5)
15
+ isoics (0.1.6)
16
16
  json (2.1.0)
17
17
  method_source (0.9.0)
18
18
  mini_portile2 (2.3.0)
@@ -55,6 +55,10 @@ module IsoBibItem
55
55
  def initialize(field:, group:, subgroup:)
56
56
  super fieldcode: field, groupcode: group, subgroupcode: subgroup
57
57
  end
58
+
59
+ def to_xml(builder)
60
+ builder.ics description
61
+ end
58
62
  end
59
63
 
60
64
  # Bibliographic item.
@@ -149,12 +153,12 @@ module IsoBibItem
149
153
  end
150
154
 
151
155
  # @return [String]
152
- def to_xml(builder = nil, **opts)
156
+ def to_xml(builder = nil, **opts, &block)
153
157
  if builder
154
- render_xml builder, opts
158
+ render_xml builder, opts, &block
155
159
  else
156
160
  Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
157
- render_xml xml, opts
161
+ render_xml xml, opts, &block
158
162
  end.doc.root.to_xml
159
163
  end
160
164
  end
@@ -173,7 +177,7 @@ module IsoBibItem
173
177
  if @docidentifier.part_number&.size&.positive?
174
178
  idstr << "-#{@docidentifier.part_number}"
175
179
  end
176
- idstr
180
+ idstr.strip
177
181
  end
178
182
 
179
183
  # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
@@ -190,7 +194,7 @@ module IsoBibItem
190
194
  c.to_xml builder
191
195
  end
192
196
  end
193
- builder.edition edition
197
+ builder.edition edition if edition
194
198
  language.each { |l| builder.language l }
195
199
  script.each { |s| builder.script s }
196
200
  abstract.each { |a| builder.abstract { a.to_xml(builder) } }
@@ -200,6 +204,8 @@ module IsoBibItem
200
204
  if opts[:note]
201
205
  builder.note("ISO DATE: #{opts[:note]}", format: 'text/plain')
202
206
  end
207
+ ics.each { |i| i.to_xml builder }
208
+ yield(builder) if block_given?
203
209
  end
204
210
  end
205
211
  # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
@@ -29,6 +29,8 @@ module IsoBibItem
29
29
  @title_part = title_part
30
30
  @language = language
31
31
  @script = script
32
+ @title_main = "[ -- ]" if @title_main.nil? || @title_main.empty?
33
+ # "[ -- ]" # title cannot be nil
32
34
  end
33
35
 
34
36
  # @return [String]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module IsoBibItem
4
- VERSION = '0.1.3'.freeze
4
+ VERSION = '0.1.4'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iso-bib-item
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
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-06-02 00:00:00.000000000 Z
11
+ date: 2018-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -163,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
163
  version: '0'
164
164
  requirements: []
165
165
  rubyforge_project:
166
- rubygems_version: 2.6.14
166
+ rubygems_version: 2.6.12
167
167
  signing_key:
168
168
  specification_version: 4
169
169
  summary: 'IsoBibItem: Ruby ISOXMLDOC impementation.'