pubid-ieee 1.15.20 → 1.15.21
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/pubid/ieee/identifier/base.rb +55 -3
- data/lib/pubid/ieee/renderer/base.rb +20 -8
- data/lib/pubid/ieee/version.rb +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: 75b9839570a5fb3f9ee5de1ca4061d4942f67b41edadf02f6677573fb05bd069
|
|
4
|
+
data.tar.gz: b09e077b53a3f6b7994fdff617ab86a89fb05f6f586d71a98ff248127f7fa6a6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3e4437f8a8aefec0dfc5b17f79b31783ba079715aa77e786d3cd4a8fac09355cb8e9122308d450f30e123490b5cc469397f23c1af1bef24ffb988a6d592a7476
|
|
7
|
+
data.tar.gz: f3ac0c314d7f9c46e8947681e81d2ad1bdc7a7b354689bf6a00f702adce1011002baa3dd6895633e8a8d45c40d9abd987e7443e7b23dce98f804d196e2db751a
|
|
@@ -143,16 +143,68 @@ module Pubid::Ieee
|
|
|
143
143
|
Identifier.create(**identifier_params)
|
|
144
144
|
end
|
|
145
145
|
|
|
146
|
+
# IEEE series carrying a registered trademark ("\u00AE"); everything else
|
|
147
|
+
# takes the unregistered mark ("\u2122"). 8802 is the ISO/IEC co-published
|
|
148
|
+
# form of the 802 series, and a project number keeps its series identity,
|
|
149
|
+
# so a leading "P" is stripped before the lookup.
|
|
150
|
+
REGISTERED_SERIES = %w[802 8802 2030].freeze
|
|
151
|
+
|
|
152
|
+
# The ISO/IEC adoption of IEEE 802: the number alone identifies the
|
|
153
|
+
# series, whatever publishers are printed.
|
|
154
|
+
ISO_ADOPTED_SERIES = "8802".freeze
|
|
155
|
+
|
|
146
156
|
# @param [:short, :full] format
|
|
147
157
|
def to_s(format = :short, with_trademark: false, annotated: false)
|
|
148
158
|
opts = { format: format, with_trademark: with_trademark, annotated: annotated }
|
|
159
|
+
params = to_h(deep: false)
|
|
160
|
+
# IEEE attaches the mark to the standard number, before the year and
|
|
161
|
+
# every suffix ("IEEE Std 1619\u2122-2007"), so it is rendered from a
|
|
162
|
+
# dedicated slot in the format templates rather than appended to the
|
|
163
|
+
# finished string. An identifier without a number of its own (an
|
|
164
|
+
# ISO-led co-publication) carries its IEEE designation in the
|
|
165
|
+
# parenthesised alternative, which is marked by the renderer instead.
|
|
166
|
+
params[:trademark] = trademark(@number) if with_trademark && @number
|
|
149
167
|
(@iso_identifier ? @iso_identifier.to_s(format: :ref_num_short, with_edition: true, annotated: annotated) : "") +
|
|
150
|
-
self.class.get_renderer_class.new(
|
|
151
|
-
(with_trademark ? trademark(
|
|
168
|
+
self.class.get_renderer_class.new(params).render(**opts) +
|
|
169
|
+
(with_trademark && !marks_a_number? ? trademark(fallback_number) : "")
|
|
152
170
|
end
|
|
153
171
|
|
|
172
|
+
# True when the rendered string carries the mark on a number of its own:
|
|
173
|
+
# either this identifier's number, or the IEEE designation it renders as
|
|
174
|
+
# a parenthesised alternative. A form that renders neither -- an
|
|
175
|
+
# ISO-led document with no IEEE designation of its own, such as
|
|
176
|
+
# "ISO/IEC/IEEE 8802-11:2012/Amd.1:2013(E)" or "IEC 61588:2009(E)" --
|
|
177
|
+
# keeps the trailing mark rather than losing it altogether.
|
|
178
|
+
def marks_a_number?
|
|
179
|
+
!@number.nil? || !@alternative.nil?
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# Document number to pick the symbol from when the mark falls back to the
|
|
183
|
+
# end of the string. The ISO identifier holds the only number there is,
|
|
184
|
+
# and for a supplement it is the *base* document that carries the series
|
|
185
|
+
# (an amendment's own `number` is its ordinal, "1").
|
|
186
|
+
def fallback_number
|
|
187
|
+
return @number if @number
|
|
188
|
+
|
|
189
|
+
iso = @iso_identifier
|
|
190
|
+
iso = iso.base while iso.respond_to?(:base) && iso.base
|
|
191
|
+
iso&.number
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# The registered mark belongs to IEEE, so it is claimed only when IEEE
|
|
195
|
+
# is among the printed publishers -- another body may simply have
|
|
196
|
+
# numbered a document 802 or 2030 ("AIEE Std No. 802" predates the IEEE
|
|
197
|
+
# 802 series by two decades). The ISO/IEC adoption 8802 is identified by
|
|
198
|
+
# its number alone, whatever publishers are printed.
|
|
154
199
|
def trademark(number)
|
|
155
|
-
|
|
200
|
+
bare = number.to_s.sub(/\AP/, "")
|
|
201
|
+
return "\u2122" unless REGISTERED_SERIES.include?(bare)
|
|
202
|
+
return "\u00AE" if bare == ISO_ADOPTED_SERIES
|
|
203
|
+
|
|
204
|
+
ieee = [@publisher, *@copublisher].compact.any? do |publisher|
|
|
205
|
+
publisher.to_s.split("/").include?("IEEE")
|
|
206
|
+
end
|
|
207
|
+
ieee ? "\u00AE" : "\u2122"
|
|
156
208
|
end
|
|
157
209
|
|
|
158
210
|
class << self
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
module Pubid::Ieee::Renderer
|
|
2
2
|
class Base < Pubid::Core::Renderer::Base
|
|
3
3
|
def render_identifier(params)
|
|
4
|
+
# %{trademark} sits immediately after the number (and its part/subpart):
|
|
5
|
+
# IEEE attaches the mark to the standard number, before the year, the
|
|
6
|
+
# draft, the corrigendum and every other suffix — "IEEE Std 802.3®-2018".
|
|
4
7
|
if params[:iso_identifier].to_s != "" && params[:number] != ""
|
|
5
|
-
" (%{publisher}%{stage}%{draft_status}%{type}%{number}%{iteration}%{part}%{subpart}%{month}%{year}%{corrigendum_comment}"\
|
|
8
|
+
" (%{publisher}%{stage}%{draft_status}%{type}%{number}%{iteration}%{part}%{subpart}%{trademark}%{month}%{year}%{corrigendum_comment}"\
|
|
6
9
|
"%{corrigendum}%{draft}%{edition})%{alternative}%{supersedes}%{reaffirmed}%{incorporates}%{supplement}"\
|
|
7
10
|
"%{revision}%{iso_amendment}%{amendment}%{edition}%{includes}%{redline}%{adoption}" % params
|
|
8
11
|
else
|
|
9
12
|
if params[:day].empty? && params[:month].empty?
|
|
10
13
|
# if only year - edition and draft after year
|
|
11
|
-
"%{publisher}%{draft_status}%{type}%{number}%{part}%{subpart}%{stage}"\
|
|
14
|
+
"%{publisher}%{draft_status}%{type}%{number}%{part}%{subpart}%{trademark}%{stage}"\
|
|
12
15
|
"%{year}%{edition}%{corrigendum_comment}%{corrigendum}%{draft}%{alternative}%{supersedes}%{reaffirmed}%{incorporates}%{supplement}"\
|
|
13
16
|
"%{revision}%{iso_amendment}%{amendment}%{includes}%{redline}%{adoption}" % params
|
|
14
17
|
else
|
|
15
18
|
# if year and month - edition and draft before
|
|
16
|
-
"%{publisher}%{draft_status}%{type}%{number}%{part}%{subpart}%{edition}%{stage}"\
|
|
19
|
+
"%{publisher}%{draft_status}%{type}%{number}%{part}%{subpart}%{trademark}%{edition}%{stage}"\
|
|
17
20
|
"%{corrigendum_comment}%{corrigendum}%{draft}%{month}%{day}%{year}%{alternative}%{supersedes}%{reaffirmed}%{incorporates}%{supplement}"\
|
|
18
21
|
"%{revision}%{iso_amendment}%{amendment}%{includes}%{redline}%{adoption}" % params
|
|
19
22
|
end
|
|
@@ -107,12 +110,21 @@ module Pubid::Ieee::Renderer
|
|
|
107
110
|
# result
|
|
108
111
|
end
|
|
109
112
|
|
|
110
|
-
def render_alternative(alternative,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
def render_alternative(alternative, opts, params)
|
|
114
|
+
# An ISO-led co-publication has no IEEE number of its own — its IEEE
|
|
115
|
+
# designation is this alternative, so the trademark belongs on that
|
|
116
|
+
# number rather than on the ISO one.
|
|
117
|
+
with_trademark = opts[:with_trademark] && !params[:number]
|
|
118
|
+
|
|
119
|
+
# `annotated` is deliberately not propagated — the nested alternative was
|
|
120
|
+
# never annotated before, and this must not change plain rendering.
|
|
121
|
+
alternatives = (alternative.is_a?(Array) ? alternative : [alternative]).map do |a|
|
|
122
|
+
Pubid::Ieee::Identifier::Base
|
|
123
|
+
.new(**Pubid::Ieee::Identifier.convert_parser_parameters(**a))
|
|
124
|
+
.to_s(with_trademark: with_trademark || false)
|
|
115
125
|
end
|
|
126
|
+
|
|
127
|
+
" (#{alternatives.join(', ')})"
|
|
116
128
|
end
|
|
117
129
|
|
|
118
130
|
def render_draft(draft, _opts, params)
|
data/lib/pubid/ieee/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pubid-ieee
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.15.
|
|
4
|
+
version: 1.15.21
|
|
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-
|
|
11
|
+
date: 2026-08-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: parslet
|
|
@@ -30,14 +30,14 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - '='
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 1.15.
|
|
33
|
+
version: 1.15.21
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - '='
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 1.15.
|
|
40
|
+
version: 1.15.21
|
|
41
41
|
description: Library to generate, parse and manipulate IEEE PubID.
|
|
42
42
|
email:
|
|
43
43
|
- open.source@ribose.com
|