relaton-render 0.5.9 → 0.5.11

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: c28914c92390ac98de57c952d050e373a60ad77cbb8d86bda033c2cf219421e6
4
+ data.tar.gz: 6daf07a35e83f26d659a8f6fbd6979c980116e2e7df1ea1c666e2290a0781efb
5
5
  SHA512:
6
- metadata.gz: f7ecf68117575c5b55b99bbad99a9eea91263ce61224253ee9149de113ce6edf66bd543dfb8d475a4ab4599572bd2701edc60c31576fa6d1475fb73cb63c2aff
7
- data.tar.gz: c9a1452e1fb08dbc7d910a63b25b3e453919b5d3d1ce7cc0c943bf1adb3f6e6a9f6d638ca1be814a9ec836c77b2e6cc66be1a3be34f733cc2aedbfad45510df3
6
+ metadata.gz: d3d40767da2463d8a34cb5203cea52edccf21ab8e73dfd6a41ad770fe2c2d1362e4254fbd22407a5e7166f5434b39d07d3b9a4569e3a19364b5e1768a645b959
7
+ data.tar.gz: 3f1fda6927d28e8bc41b8d6a4891b6b7e1e05afed3ceb42594548a86fea082d1cf74f6842189250729e485643e0377d5fc527e26a708ff46fe496d589c87892f
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.11".freeze
4
4
  end
5
5
  end
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.add_development_dependency "simplecov"
30
30
 
31
31
  spec.add_dependency "isodoc-i18n", "~> 1.1.2"
32
- spec.add_dependency "liquid", "~> 4"
32
+ spec.add_dependency "liquid", "~> 5"
33
33
  spec.add_dependency "nokogiri"
34
34
  spec.add_dependency "relaton-bib", ">= 1.13.0"
35
35
  spec.add_dependency "twitter_cldr"
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.11
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-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '4'
117
+ version: '5'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '4'
124
+ version: '5'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: nokogiri
127
127
  requirement: !ruby/object:Gem::Requirement