relaton-render 3.0.0.pre.alpha.16 → 3.0.0.pre.alpha.18
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 +4 -4
- data/lib/relaton/render/iso690/elements/creator.rb +19 -1
- data/lib/relaton/render/iso690/elements/series.rb +1 -1
- data/lib/relaton/render/iso690/elements/title.rb +6 -6
- data/lib/relaton/render/iso690/i18n.rb +3 -0
- data/lib/relaton/render/iso690/renderer.rb +7 -0
- data/lib/relaton/render/iso690/style/name_form.rb +4 -2
- data/lib/relaton/render/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 366d6cbb3430291c42f1c8b836002276120a5f0f8abfc9d3d7a1591b9818d9b9
|
|
4
|
+
data.tar.gz: 3e785f025a4d72001ba9e496321c78826b8a689b21a71419f76d59c5ae596ec0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 659c808e1247309ee2255bd7932aa55d0b43a95996812af583d454225066a5f0e12829b96765da631c370c6baebb9baf9be067655e87e3c9000a8b737b582859
|
|
7
|
+
data.tar.gz: d920c054fdaf325061155b411a5dc9834f8970c900e658b3d0b5d37d655e1ff8541cc360c3872f8fb8dcac26c6eb2de3428862817eaaba243a118f1ba80ae12a
|
|
@@ -17,7 +17,9 @@ module Relaton
|
|
|
17
17
|
def render
|
|
18
18
|
return plain_render if @short
|
|
19
19
|
|
|
20
|
-
joined = if
|
|
20
|
+
joined = if (truncated = truncated_creators)
|
|
21
|
+
truncated
|
|
22
|
+
elsif creators.empty?
|
|
21
23
|
fallback_name
|
|
22
24
|
elsif (form = @style.templates.creators) && !form.empty?
|
|
23
25
|
::Relaton::Render::Iso690::Template.new(form).evaluate(
|
|
@@ -131,6 +133,22 @@ module Relaton
|
|
|
131
133
|
end
|
|
132
134
|
end
|
|
133
135
|
|
|
136
|
+
# The style's et-al truncation ("Aluffi, P., D. Anderson,
|
|
137
|
+
# M. Hering <em>et al.</em>"): at etalCount creators, the
|
|
138
|
+
# first etalDisplay names cite, comma-joined without the
|
|
139
|
+
# terminal and-join
|
|
140
|
+
def truncated_creators
|
|
141
|
+
count = name_form.etal_count
|
|
142
|
+
display = name_form.etal_display
|
|
143
|
+
return nil if count <= 0 || display <= 0 ||
|
|
144
|
+
creators.size < count
|
|
145
|
+
|
|
146
|
+
creators.first(display).each_with_index
|
|
147
|
+
.map do |contributor, index|
|
|
148
|
+
format(contributor, first: index.zero?)
|
|
149
|
+
end.join(", ") + " <em>et al.</em>"
|
|
150
|
+
end
|
|
151
|
+
|
|
134
152
|
def format(contributor, first:)
|
|
135
153
|
person = contributor.person or return org_name(contributor)
|
|
136
154
|
name = completename_name(person, first: first) ||
|
|
@@ -52,7 +52,7 @@ module Relaton
|
|
|
52
52
|
# back to the style-wide form
|
|
53
53
|
def series_form
|
|
54
54
|
variant = @style.per_type
|
|
55
|
-
.find { |t| t.type ==
|
|
55
|
+
.find { |t| t.type == @style.kind_for(@model.type) }
|
|
56
56
|
variant&.series || @style.templates.series
|
|
57
57
|
end
|
|
58
58
|
end
|
|
@@ -13,12 +13,12 @@ module Relaton
|
|
|
13
13
|
|
|
14
14
|
def render
|
|
15
15
|
text = main_title
|
|
16
|
-
return text if analytic?
|
|
16
|
+
return text if analytic? && @short
|
|
17
17
|
if !@short &&
|
|
18
|
-
(form = @style.title_form_for(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
(form = @style.title_form_for(@style.kind_for(@model.type)))
|
|
19
|
+
# the kind's own form carries the whole emphasis
|
|
20
|
+
return ::Relaton::Render::Iso690::Template.new(form)
|
|
21
|
+
.evaluate("title" => Template::Field[!text.empty?, text])
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
"#{@style.templates.title_open}#{text}" \
|
|
@@ -31,7 +31,7 @@ module Relaton
|
|
|
31
31
|
# serial carries the emphasis
|
|
32
32
|
def analytic?
|
|
33
33
|
%w[component_part serial_part]
|
|
34
|
-
.include?(
|
|
34
|
+
.include?(@style.kind_for(@model.type))
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
# A typed main title wins; an untyped title is main by
|
|
@@ -61,6 +61,9 @@ module Relaton
|
|
|
61
61
|
fallback_warn(code)
|
|
62
62
|
path = File.join(__dir__, "i18n", "en.yml")
|
|
63
63
|
raise ArgumentError, "no i18n declarations for language #{code}" unless File.file?(path)
|
|
64
|
+
# The pack supplies the labels; the requested language still
|
|
65
|
+
# governs localization (bilingual titles select by it)
|
|
66
|
+
return from_yaml(File.read(path)).tap { |i| i.lang = code }
|
|
64
67
|
end
|
|
65
68
|
|
|
66
69
|
from_yaml(File.read(path))
|
|
@@ -75,6 +75,13 @@ module Relaton
|
|
|
75
75
|
""
|
|
76
76
|
end
|
|
77
77
|
|
|
78
|
+
# The in-text creator with its et-al truncation: the
|
|
79
|
+
# author-date tag's author part
|
|
80
|
+
def in_text_author(model)
|
|
81
|
+
Elements.build(:creator, model, style: @style, i18n: @i18n,
|
|
82
|
+
elements: @elements).in_text
|
|
83
|
+
end
|
|
84
|
+
|
|
78
85
|
# The in-text author key (the principal creator's surname, as
|
|
79
86
|
# the citation renders it): the batch disambiguation groups by
|
|
80
87
|
# it
|
|
@@ -42,9 +42,10 @@ module Relaton
|
|
|
42
42
|
# the name-date convention upcases
|
|
43
43
|
attribute :subsequent_surname_upcase, :boolean,
|
|
44
44
|
default: -> { true }
|
|
45
|
-
# At this many creators the
|
|
46
|
-
# first
|
|
45
|
+
# At this many creators the creator list truncates to the
|
|
46
|
+
# first etalDisplay names with "et al." (0 disables)
|
|
47
47
|
attribute :etal_count, :integer, default: 0
|
|
48
|
+
attribute :etal_display, :integer, default: 0
|
|
48
49
|
# Editor lists carry the role marker ("(Eds.)")
|
|
49
50
|
attribute :editors_marked, :boolean, default: -> { true }
|
|
50
51
|
|
|
@@ -63,6 +64,7 @@ module Relaton
|
|
|
63
64
|
map "initialsSeparator", to: :initials_separator
|
|
64
65
|
map "subsequentSurnameUpcase", to: :subsequent_surname_upcase
|
|
65
66
|
map "etalCount", to: :etal_count
|
|
67
|
+
map "etalDisplay", to: :etal_display
|
|
66
68
|
map "editorsMarked", to: :editors_marked
|
|
67
69
|
end
|
|
68
70
|
end
|