pubid 2.0.0.pre.alpha.56 → 2.0.0.pre.alpha.58
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/data/parg/ieee.json +1926 -1643
- data/lib/pubid/ieee/builder.rb +24 -3
- data/lib/pubid/ieee/components/draft.rb +6 -1
- data/lib/pubid/ieee/identifiers/base.rb +23 -5
- data/lib/pubid/renderers/supplement_renderer.rb +7 -3
- data/lib/pubid/version.rb +1 -1
- metadata +1 -1
data/lib/pubid/ieee/builder.rb
CHANGED
|
@@ -1151,6 +1151,13 @@ module Pubid
|
|
|
1151
1151
|
return Identifiers::Standard.new(**printed_attrs.compact)
|
|
1152
1152
|
end
|
|
1153
1153
|
|
|
1154
|
+
# The designation route ("IEEE P24748-4/D=FDIS") has no
|
|
1155
|
+
# publishers group and no parsed publisher slot; IEEE is the
|
|
1156
|
+
# sole publisher of the D= designator face, and the elections
|
|
1157
|
+
# below read the builder-local slots.
|
|
1158
|
+
attributes[:publisher] ||= "IEEE"
|
|
1159
|
+
attributes[:copublisher] ||= []
|
|
1160
|
+
|
|
1154
1161
|
# The re-parse of the pubid#203 designator render ("IEEE
|
|
1155
1162
|
# P15026.2/D=FDIS-201008") captures the stage and the verbatim
|
|
1156
1163
|
# date token (":2020", "-201008") with no publisher slot; the
|
|
@@ -1182,9 +1189,12 @@ module Pubid
|
|
|
1182
1189
|
if parsed[:iso_stage_iteration]
|
|
1183
1190
|
stage_abbr += extract_value(parsed[:iso_stage_iteration])
|
|
1184
1191
|
end
|
|
1192
|
+
# The designation route ("IEEE P24748-4/D=FDIS") carries no
|
|
1193
|
+
# publishers group, so the builder-local copublisher is nil on
|
|
1194
|
+
# it — the empty test must admit nil as none.
|
|
1185
1195
|
bare_ieee_project = parsed[:project_marker] &&
|
|
1186
1196
|
attributes[:publisher] == "IEEE" &&
|
|
1187
|
-
attributes[:copublisher]
|
|
1197
|
+
(attributes[:copublisher] || []).empty?
|
|
1188
1198
|
if bare_ieee_project && parsed[:draft_stage_year].nil?
|
|
1189
1199
|
# pubid#203: a bare-IEEE project row carrying an ISO stage is
|
|
1190
1200
|
# an IEEE draft of joint ISO/IEC work ("IEEE FDIS P15026.2,
|
|
@@ -1517,9 +1527,13 @@ module Pubid
|
|
|
1517
1527
|
if pub_data[:copublishers]
|
|
1518
1528
|
copubs = pub_data[:copublishers]
|
|
1519
1529
|
copubs = [copubs] unless copubs.is_a?(Array)
|
|
1530
|
+
# A capture may carry its own separators ("/IEC/ISO" — a
|
|
1531
|
+
# joint token glued to the leading slash); the copublisher
|
|
1532
|
+
# collection renders join("/"), so entries hold bare orgs.
|
|
1520
1533
|
attributes[:copublisher] = copubs.filter_map do |cp|
|
|
1521
1534
|
extract_value(cp[:copublisher])
|
|
1522
|
-
end
|
|
1535
|
+
end.flat_map { |c| c.to_s.sub(%r{\A/}, "").split("/") }
|
|
1536
|
+
.reject(&:empty?)
|
|
1523
1537
|
end
|
|
1524
1538
|
elsif parsed[:publisher]
|
|
1525
1539
|
attributes[:publisher] = extract_value(parsed[:publisher])
|
|
@@ -2008,7 +2022,14 @@ module Pubid
|
|
|
2008
2022
|
end
|
|
2009
2023
|
end
|
|
2010
2024
|
else
|
|
2011
|
-
|
|
2025
|
+
# A degraded wire leaf carries the whole draft clause verbatim
|
|
2026
|
+
# ("/D2.1.1" — the three-segment designator the engine cannot
|
|
2027
|
+
# structure): Draft.parse is the inverse of Draft#to_s, so it
|
|
2028
|
+
# strips the prefix instead of double-appending it.
|
|
2029
|
+
draft = Components::Draft.parse(extract_value(draft_data).to_s)
|
|
2030
|
+
attributes[:draft_obj] = draft
|
|
2031
|
+
attributes[:draft] = draft.to_s
|
|
2032
|
+
return
|
|
2012
2033
|
end
|
|
2013
2034
|
|
|
2014
2035
|
# A stage-token draft's month rides the D= designator zero-padded
|
|
@@ -169,7 +169,12 @@ day: nil, iso_stage: nil, iso_iteration: nil)
|
|
|
169
169
|
end
|
|
170
170
|
|
|
171
171
|
def to_s
|
|
172
|
-
|
|
172
|
+
# A version that already opens with a designator word ("ED4",
|
|
173
|
+
# the IEC edition-draft ordinal; an ISO/IEC stage token such
|
|
174
|
+
# as "FDIS_March") renders verbatim — prepending D
|
|
175
|
+
# concatenates a hallucinated token ("DED4", "DFDIS") that no
|
|
176
|
+
# face spells. Every other version keeps the D designator.
|
|
177
|
+
result = version&.match?(/\A(ED\d|(FDIS|FCD|CDV|DIS|CD|WD|PWI|NP))/) ? "/#{version}" : "/D#{version}"
|
|
173
178
|
result += "=#{iso_stage}" if iso_stage
|
|
174
179
|
result += ".#{iso_iteration}" if iso_stage && iso_iteration
|
|
175
180
|
result += if revision.to_s.start_with?(".")
|
|
@@ -120,13 +120,13 @@ module Pubid
|
|
|
120
120
|
# Handle draft as component object
|
|
121
121
|
if args[:draft_obj]
|
|
122
122
|
self.draft_obj = args[:draft_obj]
|
|
123
|
-
self.draft = args[:draft_obj].to_s
|
|
123
|
+
self.draft = args[:draft_obj].to_s.sub(%r{\A/}, "")
|
|
124
124
|
elsif args[:draft].is_a?(String)
|
|
125
125
|
self.draft_obj = Components::Draft.parse(args[:draft])
|
|
126
|
-
self.draft = draft_obj.to_s
|
|
126
|
+
self.draft = draft_obj.to_s.sub(%r{\A/}, "")
|
|
127
127
|
elsif args[:draft]
|
|
128
128
|
self.draft_obj = args[:draft]
|
|
129
|
-
self.draft = args[:draft].to_s
|
|
129
|
+
self.draft = args[:draft].to_s.sub(%r{\A/}, "")
|
|
130
130
|
end
|
|
131
131
|
|
|
132
132
|
# Set other attributes.
|
|
@@ -150,9 +150,11 @@ module Pubid
|
|
|
150
150
|
public_send(setter, value)
|
|
151
151
|
end
|
|
152
152
|
end
|
|
153
|
+
|
|
153
154
|
end
|
|
154
155
|
|
|
155
|
-
|
|
156
|
+
# Override accessors to return component objects.
|
|
157
|
+
|
|
156
158
|
def code
|
|
157
159
|
code_obj
|
|
158
160
|
end
|
|
@@ -231,7 +233,23 @@ module Pubid
|
|
|
231
233
|
# no expansion (Draft.parse accepts the slashless form).
|
|
232
234
|
def self.from_hash(data, options = {})
|
|
233
235
|
data = Compaction.expand(Compaction.deep_dup(data)) if data.is_a?(::Hash)
|
|
234
|
-
super
|
|
236
|
+
identifier = super
|
|
237
|
+
# == compares the raw ivars: a rebuild whose lazy readers have not
|
|
238
|
+
# run carries @code_obj/@draft_obj nil while a parse has them set,
|
|
239
|
+
# so the objects compare unequal although their serialized hashes
|
|
240
|
+
# agree (pubid#596). Materialize the runtime components eagerly.
|
|
241
|
+
identifier.materialize_runtime_components
|
|
242
|
+
identifier
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
# Rebuild the runtime components from the wire strings. Safe on every
|
|
246
|
+
# construction path: the readers' ||= no-ops when already set, and the
|
|
247
|
+
# CodeNumber rebuild covers the split-column rows that carry no code
|
|
248
|
+
# string.
|
|
249
|
+
def materialize_runtime_components
|
|
250
|
+
code_obj
|
|
251
|
+
draft_obj
|
|
252
|
+
self
|
|
235
253
|
end
|
|
236
254
|
|
|
237
255
|
# Register the identifier classes the automatic `Identifiers::*` scan
|
|
@@ -13,14 +13,18 @@ module Pubid
|
|
|
13
13
|
annotated: context.annotated,
|
|
14
14
|
)
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
# A nil typed_stage means "no stage" (metanorma-iso's draft-biblio
|
|
17
|
+
# flow assigns nil through the public setter); render the supplement
|
|
18
|
+
# without the stage segment instead of crashing on nil.render.
|
|
19
|
+
stage_str = @id.typed_stage &&
|
|
20
|
+
annotate(@id.typed_stage.render(context:),
|
|
17
21
|
typed_stage_css(@id.typed_stage),
|
|
18
22
|
annotated: context.annotated)
|
|
19
|
-
parts << "#{base_str}/#{stage_str}"
|
|
23
|
+
parts << (stage_str ? "#{base_str}/#{stage_str}" : "#{base_str}/")
|
|
20
24
|
|
|
21
25
|
num_port = render_number_portion(context)
|
|
22
26
|
if num_port && !num_port.empty? && !num_port.start_with?(":")
|
|
23
|
-
parts << (stage_str
|
|
27
|
+
parts << (stage_str&.end_with?(".") ? "" : " ")
|
|
24
28
|
end
|
|
25
29
|
parts << num_port
|
|
26
30
|
|
data/lib/pubid/version.rb
CHANGED