relaton-render 3.0.0.pre.alpha.32 → 3.0.0.pre.alpha.34

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: a4910f5153470cbaeb2050385fe5b2fb310f0d8028e64a946c419b3fd3d772df
4
- data.tar.gz: ea045152f9a08da7b2548df4c41bcd39fa6195d4bcffc9119231ccdd85a91743
3
+ metadata.gz: '00382747d147cd5b989c4233a23f0fdaa8bd3e524a6a115d5418819ec0b8924b'
4
+ data.tar.gz: fc17121ece9f630269b54eb2f8729b7878869218dcfdecbc804d1d4a6cdf53c8
5
5
  SHA512:
6
- metadata.gz: 99e29f76607ff8c1e0b84ef5fbf9fb56c9291bb87c0ecb6d771679d2a9a7f12aaa0140692fdef6f665bdd9b9e278feaf59d2466591843ada74fc4d68740bd951
7
- data.tar.gz: b5a937aae90ad6771126ece89b64bce89dc92f7fa60bebdca3719885197878125fa4d579e89990f13bc94111fc0b82dcb901d59b490ea00acca95cf8c6fccce5
6
+ metadata.gz: 84031ca7bcbdfd2b34e499a27793bbdbcf0a1ed7f26bc5f6c71a53c647f0f8fbdf4df2f07b27d03210bd44fc78758fbd1b5913e9c21c0d4f7590c00024e001a3
7
+ data.tar.gz: e2fe7991124254b4c4009053070eba05bab6cf520bf79127da9c137f28a35f4fae113a607a567d9876b9997c0d2ccf74a34ba8f5e377f904701f51cdb626d25d
@@ -289,9 +289,9 @@ is a rule to promote:
289
289
  |===
290
290
  |Flavor override |Becomes rule
291
291
 
292
- |`ItuIdentifier` |`identifier: itu`
292
+ |`ItuIdentifier` |**[impl]** promoted: `identifier: itu_identifier`
293
293
  |`NistIdentifier`, `NistCreator`, `NistDate`, `SerialDate`, `NistSeries`, `NistComponentPart`, `NistPublisher`, `Draft` |the NIST author-year rule set
294
- |`IeeeIdentifier`, `IeeeComponentPart`, `IeeeAccess`, `IeeeMedium` |the IEEE-SA rule set (designation-first standards)
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` |the BIPM rule set
296
296
  |`IhoEdition`, `IhoCreator` |affiliation-composite creators
297
297
  |`JisComponentPart`, `JisSeries`, `JisExtent` |the JIS host-citation rules
@@ -15,8 +15,104 @@ module Relaton
15
15
  end
16
16
  end
17
17
 
18
+ # The IEEE-SA identifiers: DOI and ISBN carry their kind label
19
+ # with a colon ("DOI: https://doi.org/…")
20
+ class IeeeIdentifier < Elements::Identifier
21
+ private
22
+
23
+ def render_id(docidentifier)
24
+ return "#{docidentifier.type}: #{docidentifier.content}" if
25
+ %w[DOI ISBN].include?(docidentifier.type)
26
+
27
+ super
28
+ end
29
+ end
30
+
31
+ # The IEEE component part: "in Pellegrini, A. D., and P. K.
32
+ # Smith (eds.): <em>host</em>, production" — the names first,
33
+ # the eds marker in the close paren, the host title after the
34
+ # colon, the production after a comma
35
+ class IeeeComponentPart < Elements::ComponentPart
36
+ def render
37
+ h = host or return ""
38
+ out = +"in #{host_person_names(h)} (#{eds_label(h)}): "
39
+ out += host_title.to_s
40
+ production = Elements::Production
41
+ .new(h, style: @style, i18n: @i18n).render.to_s
42
+ out += ", #{production}" unless production.empty?
43
+ out
44
+ end
45
+
46
+ private
47
+
48
+ def host_editors(h)
49
+ Array(h.contributor).select { |c| has_role?(c, "editor") }
50
+ end
51
+
52
+ def eds_label(h)
53
+ @i18n.label(host_editors(h).one? ? "ed" : "eds")
54
+ end
55
+
56
+ # The IEEE host form: the first editor inverted, subsequent
57
+ # editors direct
58
+ def host_person_names(h)
59
+ host_editors(h).each_with_index.map { |c, i|
60
+ person = c.person or next ""
61
+
62
+ if i.zero?
63
+ [person_surname(person), person_given(person)]
64
+ .reject(&:empty?).join(", ")
65
+ else
66
+ [person_given(person), person_surname(person)]
67
+ .reject(&:empty?).join(" ")
68
+ end
69
+ }.reject(&:empty?).then { |names| join_names(names) }
70
+ end
71
+ end
72
+
73
+ # The IEEE access date, bare and unbracketed
74
+ # ("accessed September 3, 2019")
75
+ class IeeeAccess < Elements::Access
76
+ def render
77
+ "#{@i18n.label('viewed')} #{date_text}"
78
+ end
79
+ end
80
+
81
+ # The IEEE medium, capitalized and carrying its own trailing
82
+ # comma ("Dataset,", "Preprint,")
83
+ class IeeeMedium < Elements::Medium
84
+ private
85
+
86
+ def medium
87
+ m = @model.medium or return ""
88
+ text = m.carrier.to_s
89
+ text = m.genre.to_s if text.empty?
90
+ text = [m.form.to_s, m.size.to_s].reject(&:empty?)
91
+ .join(", ") if text.empty?
92
+ text.empty? ? "" : "#{text.sub(/^\w/) { |c| c.upcase }},"
93
+ end
94
+ end
95
+
96
+ # The ITU identifiers: ISBN and ISSN carry their kind label
97
+ # with a colon ("ISBN 92-61-12521-9")
98
+ class ItuIdentifier < Elements::Identifier
99
+ private
100
+
101
+ def render_id(docidentifier)
102
+ return "#{docidentifier.type}: #{docidentifier.content}" if
103
+ %w[ISBN ISSN].include?(docidentifier.type)
104
+
105
+ super
106
+ end
107
+ end
108
+
18
109
  REGISTRY = {
19
110
  "status_bare" => BareStatus,
111
+ "itu_identifier" => ItuIdentifier,
112
+ "ieee_identifier" => IeeeIdentifier,
113
+ "ieee_component_part" => IeeeComponentPart,
114
+ "ieee_access" => IeeeAccess,
115
+ "ieee_medium" => IeeeMedium,
20
116
  }.freeze
21
117
 
22
118
  class << self
@@ -1,5 +1,5 @@
1
1
  module Relaton
2
2
  module Render
3
- VERSION = "3.0.0.pre.alpha.32".freeze
3
+ VERSION = "3.0.0.pre.alpha.34".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.32
4
+ version: 3.0.0.pre.alpha.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.