relaton-render 3.0.0.pre.alpha.38 → 3.0.0.pre.alpha.40
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/docs/citation-style-pack.adoc +1 -1
- data/lib/relaton/render/general.rb +3 -1
- data/lib/relaton/render/iso690/elements/pub_date.rb +9 -2
- data/lib/relaton/render/iso690/rules/jis.rb +103 -0
- data/lib/relaton/render/iso690/rules.rb +6 -2
- data/lib/relaton/render/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e1cdb48d9084de905d6277fba23cafe3d8d3c31f32211c0a51855f42e06490a6
|
|
4
|
+
data.tar.gz: bf2084c1341a243bbe3220c122b52b8a61660e1e8bf46d22797a908122e50839
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3bcc088f836cee4ef783e826b505ab6f88b40a2309d6dc1dc5e69be7c8754c4f3986ba3349fbcd45404a4708cba090e0347dfe9534d413ce54c10b3c75939bda
|
|
7
|
+
data.tar.gz: 58ec385cf5ee1ca3013015a5043c8db77caa14d7ae06eb3d722e39755aea9e991ac639ac132ce1a4e48f471737dba44d99f045233dfc5527ca172ba40b19e01e
|
|
@@ -294,7 +294,7 @@ is a rule to promote:
|
|
|
294
294
|
|`IeeeIdentifier`, `IeeeComponentPart`, `IeeeAccess`, `IeeeMedium` |**[impl]** promoted: `ieee_identifier`, `ieee_component_part`, `ieee_access`, `ieee_medium`
|
|
295
295
|
|`BipmCreator`, `BipmComponentPart`, `BipmProduction`, `BipmExtent`, `BipmMedium`, `BipmEdition`, `BipmVolume` |**[impl]** promoted: `bipm_creator`, `bipm_component_part`, `bipm_production`, `bipm_extent`, `bipm_medium`, `bipm_edition`, `bipm_volume` (slot `volsize`)
|
|
296
296
|
|`IhoEdition`, `IhoCreator` |**[impl]** promoted: `iho_edition`, `iho_creator` (the %w publisher list could never match the multiword organization name — now a string array)
|
|
297
|
-
|`JisComponentPart`, `JisSeries`, `JisExtent`
|
|
297
|
+
|`JisComponentPart`, `JisSeries`, `JisExtent` |**[impl]** promoted: `jis_component_part`, `jis_series`, `jis_extent`
|
|
298
298
|
|`BsiStatus` |status presentation
|
|
299
299
|
|===
|
|
300
300
|
|
|
@@ -56,7 +56,9 @@ module Relaton
|
|
|
56
56
|
if model.respond_to?(:formattedref) && model.formattedref
|
|
57
57
|
model.formattedref.content
|
|
58
58
|
else
|
|
59
|
-
|
|
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
|
|
@@ -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
|
-
|
|
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
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Relaton
|
|
4
|
+
module Render
|
|
5
|
+
module Iso690
|
|
6
|
+
module Rules
|
|
7
|
+
# The JIS rule set, moved verbatim from the metanorma-jis
|
|
8
|
+
# flavor's JisElements: the host-title-first component part
|
|
9
|
+
# (with the 1.x orphaned close paren), the host-series
|
|
10
|
+
# fallback, and the book-family extent. Select from pack data:
|
|
11
|
+
# rules: { component_part: jis_component_part, ... }
|
|
12
|
+
module Jis
|
|
13
|
+
# The host of a part citation, 1.x parity: the host title,
|
|
14
|
+
# then the host's principal creator, closed by a paren the
|
|
15
|
+
# 1.x cleanup had orphaned when the host role came out empty
|
|
16
|
+
# ("Collected Essays UNICEF)")
|
|
17
|
+
class JisComponentPart < Elements::ComponentPart
|
|
18
|
+
def render
|
|
19
|
+
return "" if host_title_text.empty?
|
|
20
|
+
|
|
21
|
+
"#{host_title_text} #{host_creators}#{close_paren}".strip
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def host_creators
|
|
27
|
+
author = Array(host&.contributor)
|
|
28
|
+
.find { |c| has_role?(c, "author") } or return ""
|
|
29
|
+
|
|
30
|
+
person = author.person
|
|
31
|
+
if person.nil?
|
|
32
|
+
Array(author.organization&.name).map { |n| localized(n) }
|
|
33
|
+
.reject(&:empty?).join(", ")
|
|
34
|
+
else
|
|
35
|
+
host_person_name(author, first: true)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def close_paren
|
|
40
|
+
@i18n.punct_fetch("close-paren", ")")
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# A part cites its host's series when it carries none of its
|
|
45
|
+
# own (the 1.x series fallback to the host document)
|
|
46
|
+
class JisSeries < Elements::Series
|
|
47
|
+
private
|
|
48
|
+
|
|
49
|
+
def series
|
|
50
|
+
super || Array(host_relation&.bibitem&.series).first
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def host_relation
|
|
54
|
+
Array(@model.relation).find do |r|
|
|
55
|
+
Elements::ComponentPart::HOST_RELATION_TYPES.include?(r.type)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# The book-family extent carries the volume and the page
|
|
61
|
+
# only, and repeated localities of one type collapse to the
|
|
62
|
+
# last declared (the 1.x per-type merge)
|
|
63
|
+
class JisExtent < Elements::Extent
|
|
64
|
+
def render
|
|
65
|
+
return super unless book_family?
|
|
66
|
+
|
|
67
|
+
[volume_part, page_part].reject(&:empty?).join(" ")
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
private
|
|
71
|
+
|
|
72
|
+
def book_family?
|
|
73
|
+
%w[book inbook incollection inproceedings proceedings]
|
|
74
|
+
.include?(@model.type.to_s)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def volume_part
|
|
78
|
+
loc = pick("volume") or return ""
|
|
79
|
+
loc.reference_from.to_s.empty? ? "" :
|
|
80
|
+
unit("volume", loc.reference_from)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def page_part
|
|
84
|
+
loc = pick("page") or return ""
|
|
85
|
+
from = loc.reference_from.to_s
|
|
86
|
+
to = loc.reference_to.to_s
|
|
87
|
+
if to.empty? || to == from
|
|
88
|
+
unit("page", from)
|
|
89
|
+
else
|
|
90
|
+
unit("pages", "#{from}#{@i18n.label('date_range')}#{to}")
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# The last locality of a type wins (the 1.x merge)
|
|
95
|
+
def pick(type)
|
|
96
|
+
localities.reverse.find { |l| l.type == type }
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
@@ -166,10 +166,11 @@ module Relaton
|
|
|
166
166
|
end
|
|
167
167
|
end
|
|
168
168
|
|
|
169
|
-
# The NIST and
|
|
170
|
-
# sections
|
|
169
|
+
# The NIST, BIPM and JIS rule sets live in their own
|
|
170
|
+
# autoloaded sections
|
|
171
171
|
autoload :Nist, "relaton/render/iso690/rules/nist"
|
|
172
172
|
autoload :Bipm, "relaton/render/iso690/rules/bipm"
|
|
173
|
+
autoload :Jis, "relaton/render/iso690/rules/jis"
|
|
173
174
|
|
|
174
175
|
REGISTRY = {
|
|
175
176
|
"status_bare" => BareStatus,
|
|
@@ -195,6 +196,9 @@ module Relaton
|
|
|
195
196
|
"bipm_medium" => Bipm::BipmMedium,
|
|
196
197
|
"bipm_edition" => Bipm::BipmEdition,
|
|
197
198
|
"bipm_volume" => Bipm::BipmVolume,
|
|
199
|
+
"jis_component_part" => Jis::JisComponentPart,
|
|
200
|
+
"jis_series" => Jis::JisSeries,
|
|
201
|
+
"jis_extent" => Jis::JisExtent,
|
|
198
202
|
}.freeze
|
|
199
203
|
|
|
200
204
|
class << self
|
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.
|
|
4
|
+
version: 3.0.0.pre.alpha.40
|
|
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-
|
|
11
|
+
date: 2026-10-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: htmlentities
|
|
@@ -149,6 +149,7 @@ files:
|
|
|
149
149
|
- lib/relaton/render/iso690/renderer.rb
|
|
150
150
|
- lib/relaton/render/iso690/rules.rb
|
|
151
151
|
- lib/relaton/render/iso690/rules/bipm.rb
|
|
152
|
+
- lib/relaton/render/iso690/rules/jis.rb
|
|
152
153
|
- lib/relaton/render/iso690/rules/nist.rb
|
|
153
154
|
- lib/relaton/render/iso690/style.rb
|
|
154
155
|
- lib/relaton/render/iso690/style/locale.rb
|