relaton-render 0.4.0 → 0.4.3
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/README.adoc +5 -1
- data/lib/relaton/render/fields/fields.rb +1 -1
- data/lib/relaton/render/general/citations.rb +13 -7
- data/lib/relaton/render/general/config.yml +4 -4
- data/lib/relaton/render/general/render.rb +1 -1
- data/lib/relaton/render/parse/parse_contributors.rb +7 -4
- data/lib/relaton/render/version.rb +1 -1
- data/relaton-render.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15d7bd7a186b81235cfc86e2259970512612706cd33cc09a87b98c06202d7ee7
|
4
|
+
data.tar.gz: 511378e83688bb4c0590f6012be5176cda67edd1e368e0994251b3bd638627bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48d082ba071e7b794ffced1cc4a74c691e1715b0bfad3adcfa85d58ef7b8a2dd0cc37931c6f4d9505b91209889415f930dc4d887d2b7aac5151c061912f3f8ee
|
7
|
+
data.tar.gz: 6a6786748486fbf4f065fac5951acdb5f647a5d7de652ed4dbf6d07cd344f5a3fcab3c4e9d59da521301fdc93f8e0d1552cdf0404a8d3bf363d145143f9117cc
|
data/README.adoc
CHANGED
@@ -218,7 +218,7 @@ draws on the following fields drawn from the bibliographic item:
|
|
218
218
|
| surname[0] | ./contributor[1]/person/name/surname \| ./contributor[1]/person/name/completename | | i.e. surname is the name default
|
219
219
|
| surname[1] | ./contributor[2]/name/surname | |
|
220
220
|
| surname[2] | ./contributor[3]/name/surname | |
|
221
|
-
| initials[0] | ./contributor[1]/name/initial | | If not supplied, the first letter of each given name is used instead
|
221
|
+
| initials[0] | ./contributor[1]/name/formatted-initials \| ./contributor[1]/name/forename/@initial | | If not supplied, the first letter of each given name is used instead
|
222
222
|
| initials[1] | ./contributor[2]/name/initial | |
|
223
223
|
| given[0] | ./contributor[1]/name/forename[1] | | If not supplied, initials are used instead
|
224
224
|
| given[1] | ./contributor[2]/name/forename[1] | |
|
@@ -228,6 +228,10 @@ draws on the following fields drawn from the bibliographic item:
|
|
228
228
|
| nonpersonal[1] |./contributor[2]/organization/name | Y |
|
229
229
|
|===
|
230
230
|
|
231
|
+
The `formatted-initials` field is presumed to contain full stops, and so do the surrogates of that field done by using individual
|
232
|
+
forenames' `initial` attributes, or the forename initials. If the full stops are to be stripped, that needs to occur within the
|
233
|
+
Liquid template.
|
234
|
+
|
231
235
|
There are at least three distinct `nametemplate` instances that need to be provided, one for a single contributor (`one:`), one for two contributors (`two:`), one for three or more (`more:`), and optionally one for "et al." (`etal:`). The number of contributors for which "et al." starts being used is indicated by `etal_count`.
|
232
236
|
|
233
237
|
For example:
|
@@ -61,19 +61,25 @@ module Relaton
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def suffix_date(ret)
|
64
|
-
ret.
|
65
|
-
v.
|
66
|
-
next if v1.size < 2
|
64
|
+
ret.each do |k, v|
|
65
|
+
v.each do |k1, v1|
|
66
|
+
next if v1.reject { |b| b[:date].nil? }.size < 2
|
67
67
|
|
68
|
-
|
69
|
-
b[:date] += ("a".ord + i).chr.to_s
|
70
|
-
b[:data_liquid][:date] = b[:date]
|
71
|
-
end
|
68
|
+
suffix_date1(ret, k, k1)
|
72
69
|
end
|
73
70
|
end
|
74
71
|
ret
|
75
72
|
end
|
76
73
|
|
74
|
+
def suffix_date1(ret, key1, key2)
|
75
|
+
ret[key1][key2].each_with_index do |b, i|
|
76
|
+
next if b[:date].nil?
|
77
|
+
|
78
|
+
b[:date] += ("a".ord + i).chr.to_s
|
79
|
+
b[:data_liquid][:date] = b[:date]
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
77
83
|
def to_hash(ret)
|
78
84
|
ret.each_with_object({}) do |(_k, v), m|
|
79
85
|
v.each do |_k1, v1|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
nametemplate:
|
2
|
-
one: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] | upcase }} ,_{%if given[0]%}{{given[0]}} {{middle[0]}}{%else%}{{initials[0] | join: '
|
3
|
-
two: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] | upcase}} ,_{%if given[0]%}{{given[0]}} {{middle[0]}}{%else%}{{initials[0] | join: '
|
4
|
-
more: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] | upcase}} ,_{%if given[0]%}{{given[0]}} {{middle[0]}}{%else%}{{initials[0] | join: '
|
2
|
+
one: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] | upcase }} ,_{%if given[0]%}{{given[0]}} {{middle[0]}}{%else%}{{initials[0] | join: ' '}}.{%endif%}{% endif %}"
|
3
|
+
two: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] | upcase}} ,_{%if given[0]%}{{given[0]}} {{middle[0]}}{%else%}{{initials[0] | join: ' '}}.{%endif%}{% endif %} {{ labels['and'] }} {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{%if given[1]%}{{given[1]}} {{middle[1]}}{%else%}{{initials[1] | join: ' '}}.{%endif%} {{surname[1] | upcase}}{% endif %}"
|
4
|
+
more: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] | upcase}} ,_{%if given[0]%}{{given[0]}} {{middle[0]}}{%else%}{{initials[0] | join: ' '}}.{%endif%}{% endif %} , {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{%if given[1]%}{{given[1]}} {{middle[1]}}{%else%}{{initials[1] | join: ' '}}.{%endif%} {{surname[1] | upcase}}{% endif %} {{ labels['and'] }} {% if nonpersonal[2] %}{{ nonpersonal[2] }}{% else %}{%if given[2]%}{{given[2]}} {{middle[2]}}{%else%}{{initials[2] | join: ' '}}.{%endif%} {{surname[2] | upcase}}{% endif %}"
|
5
5
|
# disabled the following: they should be provided in inheriting calls
|
6
|
-
# etal: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] | upcase}} ,_{%if given[0]%}{{given[0]}} {{middle[0]}}{%else%}{{initials[0] | join: '
|
6
|
+
# etal: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] | upcase}} ,_{%if given[0]%}{{given[0]}} {{middle[0]}}{%else%}{{initials[0] | join: ' '}}.{%endif%}{% endif %}, {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{%if given[1]%}{{given[1]}} {{middle[1]}}{%else%}{{initials[1] | join: ' '}}.{%endif%} {{surname[1] | upcase}}{% endif %} <em>et al.</em>"
|
7
7
|
# etal_count: 5
|
8
8
|
authorcitetemplate:
|
9
9
|
one: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] }}{% endif %}"
|
@@ -44,7 +44,7 @@ module Relaton
|
|
44
44
|
@nametemplate = @nametemplateklass
|
45
45
|
.new(template: opt["nametemplate"], i18n: @i18n)
|
46
46
|
@authorcitetemplate = @authorcitetemplateklass
|
47
|
-
|
47
|
+
&.new(template: opt["authorcitetemplate"], i18n: @i18n)
|
48
48
|
@seriestemplate = @seriestemplateklass
|
49
49
|
.new(template: opt["seriestemplate"], i18n: @i18n)
|
50
50
|
@journaltemplate = @seriestemplateklass
|
@@ -15,11 +15,14 @@ module Relaton
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def given_and_middle_name(person)
|
18
|
-
forenames = person.name.forename.map
|
19
|
-
|
20
|
-
|
18
|
+
forenames = person.name.forename.map do |x|
|
19
|
+
x.content.empty? ? "#{x.initial}." : x.content
|
20
|
+
end
|
21
|
+
initials = person.name.initials&.content&.sub(/(.)\.?$/, "\\1.")
|
22
|
+
initials ||= person.name.forename.map(&:initial)
|
23
|
+
.compact.map { |x| x.sub(/(.)\.?$/, "\\1.") }
|
21
24
|
forenames.empty? and initials.empty? and return [nil, nil, nil]
|
22
|
-
initials.empty? and initials = forenames.map { |x| x[0] }
|
25
|
+
initials.empty? and initials = forenames.map { |x| "#{x[0]}." }
|
23
26
|
[forenames.first, forenames[1..-1], initials]
|
24
27
|
end
|
25
28
|
|
data/relaton-render.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_dependency "isodoc-i18n"
|
32
32
|
spec.add_dependency "liquid", "~> 4"
|
33
33
|
spec.add_dependency "nokogiri"
|
34
|
-
spec.add_dependency "relaton-bib", ">= 1.
|
34
|
+
spec.add_dependency "relaton-bib", ">= 1.13.0"
|
35
35
|
spec.add_dependency "twitter_cldr"
|
36
36
|
spec.add_dependency "tzinfo-data" # we need this for windows only
|
37
37
|
#spec.metadata["rubygems_mfa_required"] = "true"
|
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.4.
|
4
|
+
version: 0.4.3
|
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-08-
|
11
|
+
date: 2022-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -142,14 +142,14 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 1.
|
145
|
+
version: 1.13.0
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 1.
|
152
|
+
version: 1.13.0
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: twitter_cldr
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|