relaton-render 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c21e6af4c8c19084d12c883fcc12ec4828965563d84eefa9ad3776fbd4997bf6
4
- data.tar.gz: df7f7dbbc98ac5de46e904cc572d9ed131921ec7b6418e3080e5115a69ab0647
3
+ metadata.gz: 15d7bd7a186b81235cfc86e2259970512612706cd33cc09a87b98c06202d7ee7
4
+ data.tar.gz: 511378e83688bb4c0590f6012be5176cda67edd1e368e0994251b3bd638627bd
5
5
  SHA512:
6
- metadata.gz: 2d0a91b6196e46b51e2aa88dd923608b885ecc369e63e56bc16fd90d5458f3300c8017d73f0524ecb32b7d811d391be0da4778649559df8a0f540b85150baf4e
7
- data.tar.gz: aa14c96d47a1b354c26dd4b99df07c334dd9404f8faf04bd7686d3071b85cc0d0769a81976d8ae83846d5334a4c36fa02a3ef0e5d66f152a80dc6ba66d5b960f
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:
@@ -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: '. '}}.{%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 %}"
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: '. '}}.{%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>"
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 %}"
@@ -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(&:content)
19
- initials = person.name.initial.map(&:content)
20
- .map { |x| x.sub(/\.$/, "") }
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
 
@@ -1,5 +1,5 @@
1
1
  module Relaton
2
2
  module Render
3
- VERSION = "0.4.2".freeze
3
+ VERSION = "0.4.3".freeze
4
4
  end
5
5
  end
@@ -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.12.0"
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.2
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-15 00:00:00.000000000 Z
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.12.0
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.12.0
152
+ version: 1.13.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: twitter_cldr
155
155
  requirement: !ruby/object:Gem::Requirement