relaton-render 3.0.0.pre.alpha.39 → 3.0.0.pre.alpha.41

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: b23f8f70f553b0788a0b1a67330c343290daeccb3156192ac64a70ea5d4a0dc0
4
- data.tar.gz: e4b1f42a9006b6714a248912b03c7e216ac76008dcfb109c68887a7cfa2c0e01
3
+ metadata.gz: eaa53e917eda4357ec51973bf0c8898c8d25fec15918eb2647874e8493c56152
4
+ data.tar.gz: 304753e30cd5897dfc6ce7b95da61cf0d018309fab1fae709cc8d3a7e0533de4
5
5
  SHA512:
6
- metadata.gz: 81f2bb416f247d63558a6ebbc25ce2d11a6d9121c5c0cbe415db3c038cca8163b82c43b44a6073b3837388243ceeb16d08946274703fcacc7067b97619cbf63b
7
- data.tar.gz: b6ff8ab41c2fd99b991124321493f7ddcf8b5112ba3111204b0f31d531cf1c5904ada98bfb0f31bf35e145516a9f25d98b230a30ac336bb8d72d60e5ed479145
6
+ metadata.gz: 6cbf5815eb1d846403a2a094a7a51723642f26014ed6a4329f82635a52feaca62599768c47cb05d58a5eaec9d6c553fba2e64cea6463cf6c641fc1f9a1ea6d45
7
+ data.tar.gz: c233dc2b8c49a57d13fa8bbc18d4fbd1c8b51b84add8da005a547406b5a609b0214bd14ca07c019abf35dee6e9736a40d755db0f2e345e62ff972ef6dd10af3d
@@ -56,7 +56,9 @@ module Relaton
56
56
  if model.respond_to?(:formattedref) && model.formattedref
57
57
  model.formattedref.content
58
58
  else
59
- @renderer.render(model, **opts)
59
+ # a collection's items may each declare their own language;
60
+ # the single-item render routes like render_all does
61
+ renderer_for(Array(model.language).first).render(model, **opts)
60
62
  end
61
63
  embedded ? text : "<formattedref>#{text}</formattedref>"
62
64
  end
@@ -13,9 +13,22 @@ module Relaton
13
13
  end
14
14
 
15
15
  def render
16
+ if (form = authorizer_form) && !form.empty?
17
+ return Template.new(form).evaluate(
18
+ "authorizer" => Template::Field[true, authorizer_name],
19
+ )
20
+ end
21
+
16
22
  authorizer_name
17
23
  end
18
24
 
25
+ # The kind's declared form for this slot
26
+ def authorizer_form
27
+ variant = @style.per_type
28
+ .find { |t| t.type == @style.kind_for(@model.type) }
29
+ variant&.authorizer
30
+ end
31
+
19
32
  private
20
33
 
21
34
  def authorizer_name
@@ -13,6 +13,16 @@ module Relaton
13
13
  end
14
14
 
15
15
  def render
16
+ if (form = production_form) && !form.empty?
17
+ return Template.new(form).evaluate(
18
+ "production" => Template::Field[true, render_production],
19
+ )
20
+ end
21
+
22
+ render_production
23
+ end
24
+
25
+ def render_production
16
26
  if publisher_first?
17
27
  return no_place_production_publisher_first if places.empty? &&
18
28
  no_place_declared?
@@ -34,6 +44,13 @@ module Relaton
34
44
  sep.empty? ? place : place.gsub(", ", sep)
35
45
  end
36
46
 
47
+ # The kind's declared form for this slot
48
+ def production_form
49
+ variant = @style.per_type
50
+ .find { |t| t.type == @style.kind_for(@model.type) }
51
+ variant&.production
52
+ end
53
+
37
54
  def publisher_first?
38
55
  @i18n.punct_fetch("production_order", "") == "publisher_first"
39
56
  end
@@ -38,8 +38,15 @@ module Relaton
38
38
  if d.from && d.to
39
39
  fy = d.from.to_date.year
40
40
  ty = d.to.to_date.year
41
- fy == ty ? fy.to_s : "#{fy}#{dash}#{ty}"
42
- elsif d.from
41
+ return (fy == ty ? fy.to_s : "#{fy}#{dash}#{ty}")
42
+ end
43
+
44
+ # A from-only date is an open run ("1925–") for a
45
+ # continuing resource; a monograph's publication date
46
+ # cites the year bare ("2022") — the trailing dash would
47
+ # leak into the terminator otherwise
48
+ if d.from && %w[continuing serial_part online webdoc]
49
+ .include?(item_kind)
43
50
  "#{d.from.to_date.year}#{dash}"
44
51
  end
45
52
  end
@@ -11,6 +11,12 @@ module Relaton
11
11
  attribute :template, :string
12
12
  attribute :series, :string
13
13
  attribute :title, :string
14
+ # Per-slot form overrides for the production and the
15
+ # authorizer: wrappers over the element's own render, so a
16
+ # kind can carry its slot's separator in the form
17
+ # (", {{production}}" over the engine's ". " glue)
18
+ attribute :production, :string
19
+ attribute :authorizer, :string
14
20
  attribute :home, :boolean
15
21
  attribute :fallbacks, :hash, default: -> { {} }
16
22
  # The short-cite template for this kind; absent falls back to
@@ -25,6 +31,8 @@ module Relaton
25
31
  map "template", to: :template
26
32
  map "series", to: :series
27
33
  map "title", to: :title
34
+ map "production", to: :production
35
+ map "authorizer", to: :authorizer
28
36
  map "home", to: :home
29
37
  map "fallbacks", to: :fallbacks
30
38
  map "short", to: :short
@@ -1,5 +1,5 @@
1
1
  module Relaton
2
2
  module Render
3
- VERSION = "3.0.0.pre.alpha.39".freeze
3
+ VERSION = "3.0.0.pre.alpha.41".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: 3.0.0.pre.alpha.39
4
+ version: 3.0.0.pre.alpha.41
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-10-09 00:00:00.000000000 Z
11
+ date: 2026-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities