relaton-render 3.0.0.pre.alpha.40 → 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: e1cdb48d9084de905d6277fba23cafe3d8d3c31f32211c0a51855f42e06490a6
4
- data.tar.gz: bf2084c1341a243bbe3220c122b52b8a61660e1e8bf46d22797a908122e50839
3
+ metadata.gz: eaa53e917eda4357ec51973bf0c8898c8d25fec15918eb2647874e8493c56152
4
+ data.tar.gz: 304753e30cd5897dfc6ce7b95da61cf0d018309fab1fae709cc8d3a7e0533de4
5
5
  SHA512:
6
- metadata.gz: 3bcc088f836cee4ef783e826b505ab6f88b40a2309d6dc1dc5e69be7c8754c4f3986ba3349fbcd45404a4708cba090e0347dfe9534d413ce54c10b3c75939bda
7
- data.tar.gz: 58ec385cf5ee1ca3013015a5043c8db77caa14d7ae06eb3d722e39755aea9e991ac639ac132ce1a4e48f471737dba44d99f045233dfc5527ca172ba40b19e01e
6
+ metadata.gz: 6cbf5815eb1d846403a2a094a7a51723642f26014ed6a4329f82635a52feaca62599768c47cb05d58a5eaec9d6c553fba2e64cea6463cf6c641fc1f9a1ea6d45
7
+ data.tar.gz: c233dc2b8c49a57d13fa8bbc18d4fbd1c8b51b84add8da005a547406b5a609b0214bd14ca07c019abf35dee6e9736a40d755db0f2e345e62ff972ef6dd10af3d
@@ -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
@@ -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.40".freeze
3
+ VERSION = "3.0.0.pre.alpha.41".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
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.40
4
+ version: 3.0.0.pre.alpha.41
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.