relaton-render 0.5.9 → 0.5.10

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: 4279b77e453986c5068226fd078df3c97746d9ebbbe04a0b1217eccb27804030
4
- data.tar.gz: c2340eca6f974d0fca1f6120fb50d1092dc9159a7d658734e3f750cf149b6692
3
+ metadata.gz: be542bce28bee8b30b8a719d8e6e822fb998c7d042c2c7b546309733c3ca1d66
4
+ data.tar.gz: 5be41eba5e9771af4d39bcf7e2df8d4344db4ad9275d2fbf97fcb9c3f7eef362
5
5
  SHA512:
6
- metadata.gz: f7ecf68117575c5b55b99bbad99a9eea91263ce61224253ee9149de113ce6edf66bd543dfb8d475a4ab4599572bd2701edc60c31576fa6d1475fb73cb63c2aff
7
- data.tar.gz: c9a1452e1fb08dbc7d910a63b25b3e453919b5d3d1ce7cc0c943bf1adb3f6e6a9f6d638ca1be814a9ec836c77b2e6cc66be1a3be34f733cc2aedbfad45510df3
6
+ metadata.gz: 54acff0f3354e44e6af2fe54fc20dd1f1f814b4d632604e820b6ab72a04275dc0b46dcd7981dd7a12f17ddea05506ed73b7c6401b31fe35097b90d5352ea3b5b
7
+ data.tar.gz: 4a584b500e0e6438fdc69340386c641e6f79780ca8cbe0d01811fddcb0d5baafa99e5679a447efad08e5e6e15d4de2ba5dd56fc7e4832ee914ec6412009d1dd9
data/README.adoc CHANGED
@@ -165,7 +165,7 @@ drawn from the bibliographic item:
165
165
  | creatornames | ./contributor[role/@type = 'author'] \| ./contributor[role/@type = 'performer'] \| ./contributor[role/@type = 'adapter'] \| ./contributor[role/@type = 'translator'] \| ./contributor[role/@type = 'editor'] \| ./contributor[role/@type = 'distributor'] \| ./contributor[role/@type = 'authorizer'] \| ./contributor | Y | | <<nametemplate,`nametemplate`>> applied to each name; joining template from internationalisation applied to multiple names
166
166
  | authorcite | ./contributor[role/@type = 'author'] \| ./contributor[role/@type = 'performer'] \| ./contributor[role/@type = 'adapter'] \| ./contributor[role/@type = 'translator'] \| ./contributor[role/@type = 'editor'] \| ./contributor[role/@type = 'distributor'] \| ./contributor[role/@type = 'authorizer'] \| ./contributor | Y | | <<authorcitetemplate,`authorcitetemplate`>> applied to each name; joining template from internationalisation applied to multiple names
167
167
  | role | ./contributor[role/description] \| ./contributor[role/@type] | | |
168
- | date | ./date[@type = 'issued'] \| ./date[@type = 'circulated'] \| ./date | | Y |
168
+ | date | ./date[@type = 'issued'] \| ./date[@type = 'circulated'] \| ./date | | Y | Always truncated to just year
169
169
  | date_updated | ./date[@type = 'updated'] | | Y |
170
170
  | date_accessed | ./date[@type = 'accessed'] | | Y |
171
171
  | series | ./series[@type = 'main' or not(@type) or true] | | Y | <<seriestemplate,`seriestemplate`>> applies to series
@@ -157,12 +157,12 @@ module Relaton
157
157
  end
158
158
 
159
159
  def range(hash)
160
- if hash[:on] then hash[:on]
161
- elsif hash.has_key?(:from) && hash[:from].nil? then nil
162
- elsif hash[:from]
163
- hash[:to] ? "#{hash[:from]}&#x2013;#{hash[:to]}" : hash[:from]
164
- else hash
165
- end
160
+ hash[:on] and return hash[:on]
161
+ hash.has_key?(:from) && hash[:from].nil? and return nil
162
+ !hash[:from] and return hash
163
+ hash[:to] && hash[:to] != hash[:from] and
164
+ return "#{hash[:from]}&#x2013;#{hash[:to]}"
165
+ hash[:from]
166
166
  end
167
167
 
168
168
  def sizeformat(size, hash)
@@ -199,10 +199,8 @@ module Relaton
199
199
  end
200
200
 
201
201
  def date_range(hash)
202
- if hash[:from]
203
- "#{hash[:from]}&#x2013;#{hash[:to]}"
204
- else range(hash)
205
- end
202
+ hash[:from] && !hash[:to] and return "#{hash[:from]}&#x2013;"
203
+ range(hash)
206
204
  end
207
205
 
208
206
  def dateformat(date, _hash)
@@ -112,10 +112,13 @@ module Relaton
112
112
  date.first
113
113
  end
114
114
 
115
+ # year-only
115
116
  def date(doc, host)
116
117
  ret = date1(doc.date)
117
118
  host and ret ||= date1(host.date)
118
- datepick(ret)
119
+ datepick(ret)&.transform_values do |v|
120
+ v&.sub(/-.*$/, "")
121
+ end
119
122
  end
120
123
 
121
124
  def date_updated(doc, host)
@@ -102,8 +102,9 @@ module Relaton
102
102
 
103
103
  def other_identifier(doc)
104
104
  doc.docidentifier.each_with_object([]) do |id, ret|
105
- other_identifier_include.include? id.type or next
106
- ret << @i18n.l10n("#{id.type}: #{id.id}")
105
+ type = id.type&.sub(/^(ISBN|ISSN)\..*$/, "\\1")
106
+ other_identifier_include.include? type or next
107
+ ret << @i18n.l10n("#{type}: #{id.id}")
107
108
  end
108
109
  end
109
110
 
@@ -1,5 +1,5 @@
1
1
  module Relaton
2
2
  module Render
3
- VERSION = "0.5.9".freeze
3
+ VERSION = "0.5.10".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-render
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.9
4
+ version: 0.5.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-22 00:00:00.000000000 Z
11
+ date: 2023-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler