pubid 2.0.41 → 2.0.43
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/bsi_pfs.json +1 -1
- data/data/parg/iso.json +1 -1
- data/data/parg/iso.parg +406 -5
- data/lib/pubid/bsi_pfs/adopted_base.rb +67 -14
- data/lib/pubid/bsi_pfs/builder.rb +37 -2
- data/lib/pubid/bsi_pfs/identifier.rb +9 -10
- data/lib/pubid/bsi_pfs/identifiers/adopted_european_norm.rb +21 -11
- data/lib/pubid/bsi_pfs/identifiers/adopted_international_standard.rb +21 -11
- data/lib/pubid/bsi_pfs/identifiers/consolidated_identifier.rb +25 -9
- data/lib/pubid/bsi_pfs/identifiers/draft_document.rb +6 -6
- data/lib/pubid/bsi_pfs/identifiers/publicly_available_specification.rb +6 -6
- data/lib/pubid/bsi_pfs/identifiers/published_document.rb +6 -6
- data/lib/pubid/bsi_pfs/identifiers/technical_specification.rb +6 -6
- data/lib/pubid/bsi_pfs/pubid_urn_schema.rb +17 -4
- data/lib/pubid/bsi_pfs/renderer.rb +18 -2
- data/lib/pubid/bsi_pfs/urn_generator.rb +31 -6
- data/lib/pubid/iso/CLAUDE.md +25 -0
- data/lib/pubid/iso/builder.rb +23 -0
- data/lib/pubid/version.rb +1 -1
- metadata +1 -1
|
@@ -17,19 +17,16 @@ module Pubid
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
attribute :publisher, ::Pubid::Components::Publisher, default: -> { self.class.default_publisher }
|
|
20
|
-
attribute :type, ::Pubid::Components::Type, default: -> { self.class.default_type }
|
|
21
|
-
|
|
22
|
-
def self.default_type
|
|
23
|
-
::Pubid::Components::Type.new(abbr: type[:short])
|
|
24
|
-
end
|
|
25
20
|
|
|
26
21
|
# The adopted document (feature 4): the whole identity lives
|
|
27
|
-
# on the nested ISO/IEC identifier
|
|
28
|
-
|
|
22
|
+
# on the nested ISO/IEC identifier, under the declared
|
|
23
|
+
# model column (the uniform `base` renames the wrapper
|
|
24
|
+
# slot — the codec's root-first walk and the from_hash
|
|
25
|
+
# key read it).
|
|
26
|
+
attribute :base, ::Pubid::Identifier, polymorphic: true
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
end
|
|
28
|
+
# The column IS the uniform parent accessor: #root and
|
|
29
|
+
# #base_document are the shared machinery's, walking it.
|
|
33
30
|
|
|
34
31
|
# MR "cen.iso.ts.21003-7": the publisher group fused, then the
|
|
35
32
|
# adopted document's own MR string in place of a number.
|
|
@@ -38,10 +35,23 @@ module Pubid
|
|
|
38
35
|
.map { |p| p.to_s.downcase })
|
|
39
36
|
end
|
|
40
37
|
|
|
38
|
+
# The wrapper carries no identity of its own: the MR slug
|
|
39
|
+
# reads the ROOT document (the coded RootIdentity shape),
|
|
40
|
+
# so an adoption slugs bs.1073-2.2002, not the adopted
|
|
41
|
+
# document's own MR string.
|
|
41
42
|
def mr_number_with_part
|
|
42
|
-
|
|
43
|
+
root.equal?(self) ? super : root.mr_number_with_part
|
|
43
44
|
end
|
|
44
45
|
|
|
46
|
+
def mr_year
|
|
47
|
+
root.equal?(self) ? super : root.mr_year
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# The wrapper's own edition face (the declared glued ED
|
|
51
|
+
# form): the hook lifts the trailing face+ordinal out of
|
|
52
|
+
# the adopted run onto this column.
|
|
53
|
+
attribute :edition, :string
|
|
54
|
+
|
|
45
55
|
# The scheme-canonical wire tag declared in the definition:
|
|
46
56
|
# to_hash stays byte-identical with the scheme's coded
|
|
47
57
|
# flavor, and this flavor's own from_hash routes the tag
|
|
@@ -17,19 +17,16 @@ module Pubid
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
attribute :publisher, ::Pubid::Components::Publisher, default: -> { self.class.default_publisher }
|
|
20
|
-
attribute :type, ::Pubid::Components::Type, default: -> { self.class.default_type }
|
|
21
|
-
|
|
22
|
-
def self.default_type
|
|
23
|
-
::Pubid::Components::Type.new(abbr: type[:short])
|
|
24
|
-
end
|
|
25
20
|
|
|
26
21
|
# The adopted document (feature 4): the whole identity lives
|
|
27
|
-
# on the nested ISO/IEC identifier
|
|
28
|
-
|
|
22
|
+
# on the nested ISO/IEC identifier, under the declared
|
|
23
|
+
# model column (the uniform `base` renames the wrapper
|
|
24
|
+
# slot — the codec's root-first walk and the from_hash
|
|
25
|
+
# key read it).
|
|
26
|
+
attribute :base, ::Pubid::Identifier, polymorphic: true
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
end
|
|
28
|
+
# The column IS the uniform parent accessor: #root and
|
|
29
|
+
# #base_document are the shared machinery's, walking it.
|
|
33
30
|
|
|
34
31
|
# MR "cen.iso.ts.21003-7": the publisher group fused, then the
|
|
35
32
|
# adopted document's own MR string in place of a number.
|
|
@@ -38,10 +35,23 @@ module Pubid
|
|
|
38
35
|
.map { |p| p.to_s.downcase })
|
|
39
36
|
end
|
|
40
37
|
|
|
38
|
+
# The wrapper carries no identity of its own: the MR slug
|
|
39
|
+
# reads the ROOT document (the coded RootIdentity shape),
|
|
40
|
+
# so an adoption slugs bs.1073-2.2002, not the adopted
|
|
41
|
+
# document's own MR string.
|
|
41
42
|
def mr_number_with_part
|
|
42
|
-
|
|
43
|
+
root.equal?(self) ? super : root.mr_number_with_part
|
|
43
44
|
end
|
|
44
45
|
|
|
46
|
+
def mr_year
|
|
47
|
+
root.equal?(self) ? super : root.mr_year
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# The wrapper's own edition face (the declared glued ED
|
|
51
|
+
# form): the hook lifts the trailing face+ordinal out of
|
|
52
|
+
# the adopted run onto this column.
|
|
53
|
+
attribute :edition, :string
|
|
54
|
+
|
|
45
55
|
# The scheme-canonical wire tag declared in the definition:
|
|
46
56
|
# to_hash stays byte-identical with the scheme's coded
|
|
47
57
|
# flavor, and this flavor's own from_hash routes the tag
|
|
@@ -2,7 +2,8 @@ module Pubid
|
|
|
2
2
|
module BsiPfs
|
|
3
3
|
module Identifiers
|
|
4
4
|
# The consolidated (plus-run) bundle: the base document is
|
|
5
|
-
# the first member;
|
|
5
|
+
# the first member; each member amends it, so the members
|
|
6
|
+
# carry it as their base (the coded builder's shape).
|
|
6
7
|
class ConsolidatedIdentifier < ::Pubid::BsiPfs::Identifier
|
|
7
8
|
attribute :identifiers, ::Pubid::BsiPfs::Identifier,
|
|
8
9
|
polymorphic: true, collection: true
|
|
@@ -21,15 +22,30 @@ module Pubid
|
|
|
21
22
|
identifiers&.first || self
|
|
22
23
|
end
|
|
23
24
|
|
|
24
|
-
# The
|
|
25
|
-
#
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
# The declared marker-less bundle (the coded-BSI shape): the
|
|
26
|
+
# wrapper reads the base document's identity and drops the
|
|
27
|
+
# member suffixes — the delegated publisher (off the wrapper's
|
|
28
|
+
# own wire entry, the coded compact-hash rule), the typed trio
|
|
29
|
+
# the base document carries, and the root-through MR hooks.
|
|
30
|
+
def type
|
|
31
|
+
member = identifiers&.first
|
|
32
|
+
member.respond_to?(:typed_stage) && member.typed_stage ? member.type : nil
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def publisher
|
|
36
|
+
identifiers&.first&.publisher
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def self.compact_hash(_model, hash)
|
|
40
|
+
hash.delete("publisher")
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def mr_number_with_part
|
|
44
|
+
root.equal?(self) ? super : root.mr_number_with_part
|
|
45
|
+
end
|
|
29
46
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
.join(::Pubid::Renderers::MrString::SEPARATOR_SUPPLEMENT)
|
|
47
|
+
def mr_year
|
|
48
|
+
root.equal?(self) ? super : root.mr_year
|
|
33
49
|
end
|
|
34
50
|
|
|
35
51
|
def self.polymorphic_name
|
|
@@ -4,6 +4,11 @@ module Pubid
|
|
|
4
4
|
# Concrete Draft Document identifier type (PFS type `draft_document`).
|
|
5
5
|
class DraftDocument < Identifier
|
|
6
6
|
TYPED_STAGES = [
|
|
7
|
+
::Pubid::Components::TypedStage.new(
|
|
8
|
+
code: :pubdd, stage_code: :published,
|
|
9
|
+
type_code: :dd, abbr: ["DD"],
|
|
10
|
+
name: "Draft Document", harmonized_stages: ["60.00", "60.60"],
|
|
11
|
+
),
|
|
7
12
|
].freeze
|
|
8
13
|
|
|
9
14
|
def self.type
|
|
@@ -13,15 +18,10 @@ module Pubid
|
|
|
13
18
|
# The publisher default (feature 5): the type's own token
|
|
14
19
|
# when the type is its designation, else the scheme default.
|
|
15
20
|
def self.default_publisher
|
|
16
|
-
::Pubid::Components::Publisher.new(body: "
|
|
21
|
+
::Pubid::Components::Publisher.new(body: "BS")
|
|
17
22
|
end
|
|
18
23
|
|
|
19
24
|
attribute :publisher, ::Pubid::Components::Publisher, default: -> { self.class.default_publisher }
|
|
20
|
-
attribute :type, ::Pubid::Components::Type, default: -> { self.class.default_type }
|
|
21
|
-
|
|
22
|
-
def self.default_type
|
|
23
|
-
::Pubid::Components::Type.new(abbr: type[:short])
|
|
24
|
-
end
|
|
25
25
|
|
|
26
26
|
# The scheme-canonical wire tag declared in the definition:
|
|
27
27
|
# to_hash stays byte-identical with the scheme's coded
|
|
@@ -4,6 +4,11 @@ module Pubid
|
|
|
4
4
|
# Concrete Publicly Available Specification identifier type (PFS type `publicly_available_specification`).
|
|
5
5
|
class PubliclyAvailableSpecification < Identifier
|
|
6
6
|
TYPED_STAGES = [
|
|
7
|
+
::Pubid::Components::TypedStage.new(
|
|
8
|
+
code: :pubpas, stage_code: :published,
|
|
9
|
+
type_code: :pas, abbr: ["PAS"],
|
|
10
|
+
name: "Publicly Available Specification", harmonized_stages: ["60.00", "60.60"],
|
|
11
|
+
),
|
|
7
12
|
].freeze
|
|
8
13
|
|
|
9
14
|
def self.type
|
|
@@ -13,15 +18,10 @@ module Pubid
|
|
|
13
18
|
# The publisher default (feature 5): the type's own token
|
|
14
19
|
# when the type is its designation, else the scheme default.
|
|
15
20
|
def self.default_publisher
|
|
16
|
-
::Pubid::Components::Publisher.new(body: "
|
|
21
|
+
::Pubid::Components::Publisher.new(body: "BS")
|
|
17
22
|
end
|
|
18
23
|
|
|
19
24
|
attribute :publisher, ::Pubid::Components::Publisher, default: -> { self.class.default_publisher }
|
|
20
|
-
attribute :type, ::Pubid::Components::Type, default: -> { self.class.default_type }
|
|
21
|
-
|
|
22
|
-
def self.default_type
|
|
23
|
-
::Pubid::Components::Type.new(abbr: type[:short])
|
|
24
|
-
end
|
|
25
25
|
|
|
26
26
|
# The scheme-canonical wire tag declared in the definition:
|
|
27
27
|
# to_hash stays byte-identical with the scheme's coded
|
|
@@ -4,6 +4,11 @@ module Pubid
|
|
|
4
4
|
# Concrete Published Document identifier type (PFS type `published_document`).
|
|
5
5
|
class PublishedDocument < Identifier
|
|
6
6
|
TYPED_STAGES = [
|
|
7
|
+
::Pubid::Components::TypedStage.new(
|
|
8
|
+
code: :pubpd, stage_code: :published,
|
|
9
|
+
type_code: :pd, abbr: ["PD"],
|
|
10
|
+
name: "Published Document", harmonized_stages: ["60.00", "60.60"],
|
|
11
|
+
),
|
|
7
12
|
].freeze
|
|
8
13
|
|
|
9
14
|
def self.type
|
|
@@ -13,15 +18,10 @@ module Pubid
|
|
|
13
18
|
# The publisher default (feature 5): the type's own token
|
|
14
19
|
# when the type is its designation, else the scheme default.
|
|
15
20
|
def self.default_publisher
|
|
16
|
-
::Pubid::Components::Publisher.new(body: "
|
|
21
|
+
::Pubid::Components::Publisher.new(body: "BS")
|
|
17
22
|
end
|
|
18
23
|
|
|
19
24
|
attribute :publisher, ::Pubid::Components::Publisher, default: -> { self.class.default_publisher }
|
|
20
|
-
attribute :type, ::Pubid::Components::Type, default: -> { self.class.default_type }
|
|
21
|
-
|
|
22
|
-
def self.default_type
|
|
23
|
-
::Pubid::Components::Type.new(abbr: type[:short])
|
|
24
|
-
end
|
|
25
25
|
|
|
26
26
|
# The scheme-canonical wire tag declared in the definition:
|
|
27
27
|
# to_hash stays byte-identical with the scheme's coded
|
|
@@ -4,6 +4,11 @@ module Pubid
|
|
|
4
4
|
# Concrete Technical Specification identifier type (PFS type `technical_specification`).
|
|
5
5
|
class TechnicalSpecification < Identifier
|
|
6
6
|
TYPED_STAGES = [
|
|
7
|
+
::Pubid::Components::TypedStage.new(
|
|
8
|
+
code: :pubts, stage_code: :published,
|
|
9
|
+
type_code: :ts, abbr: ["TS"],
|
|
10
|
+
name: "Technical Specification", harmonized_stages: ["60.00", "60.60"],
|
|
11
|
+
),
|
|
7
12
|
].freeze
|
|
8
13
|
|
|
9
14
|
def self.type
|
|
@@ -13,15 +18,10 @@ module Pubid
|
|
|
13
18
|
# The publisher default (feature 5): the type's own token
|
|
14
19
|
# when the type is its designation, else the scheme default.
|
|
15
20
|
def self.default_publisher
|
|
16
|
-
::Pubid::Components::Publisher.new(body: "
|
|
21
|
+
::Pubid::Components::Publisher.new(body: "BS")
|
|
17
22
|
end
|
|
18
23
|
|
|
19
24
|
attribute :publisher, ::Pubid::Components::Publisher, default: -> { self.class.default_publisher }
|
|
20
|
-
attribute :type, ::Pubid::Components::Type, default: -> { self.class.default_type }
|
|
21
|
-
|
|
22
|
-
def self.default_type
|
|
23
|
-
::Pubid::Components::Type.new(abbr: type[:short])
|
|
24
|
-
end
|
|
25
25
|
|
|
26
26
|
# The scheme-canonical wire tag declared in the definition:
|
|
27
27
|
# to_hash stays byte-identical with the scheme's coded
|
|
@@ -6,17 +6,30 @@
|
|
|
6
6
|
# namespace; identifiers carry the scheme's wire tag, so their
|
|
7
7
|
# pubid URNs encode through the scheme's own schema.
|
|
8
8
|
PubidUrnSchema = Pubid::PubidUrn.define("bsi_pfs") do
|
|
9
|
-
atom "publisher", "
|
|
9
|
+
atom "publisher.body", "pubbody"
|
|
10
10
|
atom "part", "part"
|
|
11
11
|
atom "year", "year"
|
|
12
|
-
atom "
|
|
12
|
+
atom "edition", "ed"
|
|
13
|
+
atom "type.abbr", "typeabbr"
|
|
14
|
+
atom "type.name", "typename"
|
|
15
|
+
atom "type.type_code", "typetypecode"
|
|
16
|
+
atom "stage.abbr", "stageabbr"
|
|
17
|
+
atom "stage.name", "stagename"
|
|
18
|
+
atom "stage.stage_code", "stagecode"
|
|
19
|
+
atom "stage.harmonized_stages", "stagehs", kind: :list
|
|
20
|
+
atom "typed_stage.abbr", "tsabbr", kind: :list
|
|
21
|
+
atom "typed_stage.name", "tsname"
|
|
22
|
+
atom "typed_stage.code", "tscode"
|
|
23
|
+
atom "typed_stage.stage_code", "tsstagecode"
|
|
24
|
+
atom "typed_stage.type_code", "tstypecode"
|
|
25
|
+
atom "typed_stage.harmonized_stages", "tshs", kind: :list
|
|
13
26
|
atom "identifiers", "ids", kind: :ids
|
|
14
27
|
type "pubid:bsi:adopted-european-norm", "aen", core: []
|
|
15
28
|
type "pubid:bsi:adopted-international-standard", "ais", core: []
|
|
16
|
-
type "pubid:bsi:amendment", "amd", core: []
|
|
29
|
+
type "pubid:bsi:amendment", "amd", core: ["number"]
|
|
17
30
|
type "pubid:bsi:british-standard", "bs", core: ["number"]
|
|
18
31
|
type "pubid:bsi:consolidated-identifier", "consol", core: []
|
|
19
|
-
type "pubid:bsi:corrigendum", "cor", core: []
|
|
32
|
+
type "pubid:bsi:corrigendum", "cor", core: ["number"]
|
|
20
33
|
type "pubid:bsi:draft-document", "dd", core: ["number"]
|
|
21
34
|
type "pubid:bsi:published-document", "pd", core: ["number"]
|
|
22
35
|
type "pubid:bsi:publicly-available-specification", "pas", core: ["number"]
|
|
@@ -2,6 +2,11 @@ module Pubid
|
|
|
2
2
|
module BsiPfs
|
|
3
3
|
# Human renderer, generated from the canonical template.
|
|
4
4
|
class Renderer < ::Pubid::Renderers::Base
|
|
5
|
+
# The designation faces (the typed trio): the token that
|
|
6
|
+
# selected the class prints where the face names the
|
|
7
|
+
# publisher — the column keeps the organization default.
|
|
8
|
+
DESIGNATION_FACES = ["PAS", "PD", "DD", "TS"].freeze
|
|
9
|
+
|
|
5
10
|
def render(**_opts)
|
|
6
11
|
f = render_fields(@id)
|
|
7
12
|
"#{if f[:publisher] && f[:adopted]; "#{f[:publisher]} #{f[:adopted]}" elsif f[:publisher] && f[:number]; "#{f[:publisher]} #{f[:number]}#{("-#{f[:part]}") if f[:part]}#{(":#{f[:year]}") if f[:year]}"; end}#{("#{f[:supplements]}") if f[:supplements]}"
|
|
@@ -9,6 +14,17 @@ module Pubid
|
|
|
9
14
|
|
|
10
15
|
private
|
|
11
16
|
|
|
17
|
+
# The adoption face: the adopted document, with the
|
|
18
|
+
# wrapper's own edition face after it (the declared glued
|
|
19
|
+
# ED form — the hook lifts the ordinal onto the wrapper).
|
|
20
|
+
def view_adopted(root)
|
|
21
|
+
adopted = root.respond_to?(:base) ? root.base : nil
|
|
22
|
+
return nil unless adopted
|
|
23
|
+
|
|
24
|
+
edition = root.edition
|
|
25
|
+
edition ? "#{adopted} ED#{edition}" : adopted.to_s
|
|
26
|
+
end
|
|
27
|
+
|
|
12
28
|
# The field view: a wrapper reads through to the wrapped
|
|
13
29
|
# standard and composes the printed run once — the standalone
|
|
14
30
|
# chain behind its slash, the consolidated members behind the
|
|
@@ -31,11 +47,11 @@ module Pubid
|
|
|
31
47
|
run << "+#{member.supplement_notation}"
|
|
32
48
|
end
|
|
33
49
|
view = {
|
|
34
|
-
publisher: root.publisher&.respond_to?(:body) ? root.publisher.body : root.publisher,
|
|
50
|
+
publisher: (t = root.type&.abbr) && DESIGNATION_FACES.include?(t) ? t : (root.publisher&.respond_to?(:body) ? root.publisher.body : root.publisher),
|
|
35
51
|
number: root.number,
|
|
36
52
|
part: root.part,
|
|
37
53
|
year: root.date&.year,
|
|
38
|
-
adopted: root
|
|
54
|
+
adopted: view_adopted(root),
|
|
39
55
|
}
|
|
40
56
|
view[:supplements] = run.empty? ? nil : run
|
|
41
57
|
view
|
|
@@ -5,8 +5,8 @@ module Pubid
|
|
|
5
5
|
# (feature 6) — the publisher group, the adopted document's
|
|
6
6
|
# fused MR string, the composed code, the year, the draft
|
|
7
7
|
# stage. A wrapper reads through to its subject and appends
|
|
8
|
-
# its declared chain; the
|
|
9
|
-
# member
|
|
8
|
+
# its declared chain; the marker-less bundle appends each
|
|
9
|
+
# member's chain directly (the coded-BSI shape).
|
|
10
10
|
class UrnGenerator < ::Pubid::UrnGenerator::Base
|
|
11
11
|
def urn_namespace
|
|
12
12
|
"bsi"
|
|
@@ -31,7 +31,6 @@ module Pubid
|
|
|
31
31
|
parts.concat(official_segments)
|
|
32
32
|
parts.concat(wrapper)
|
|
33
33
|
members&.each do |member|
|
|
34
|
-
parts << "plus"
|
|
35
34
|
parts.concat(wrapper_segments(member))
|
|
36
35
|
end
|
|
37
36
|
parts.concat(frag_segments)
|
|
@@ -43,13 +42,39 @@ module Pubid
|
|
|
43
42
|
def official_segments
|
|
44
43
|
segments = []
|
|
45
44
|
segments << @identifier.publisher.to_s.downcase if @identifier.publisher
|
|
46
|
-
segments <<
|
|
47
|
-
segments << "-" +
|
|
48
|
-
|
|
45
|
+
segments << identity(:number) if identity(:number)
|
|
46
|
+
segments << "-" + identity(:part).to_s if identity(:part)
|
|
47
|
+
segments << "-" + identity(:subpart).to_s if identity(:subpart)
|
|
48
|
+
date = [identity(:date)&.year].compact
|
|
49
49
|
segments << date.join("-") unless date.empty?
|
|
50
|
+
segments << "v" + @identifier.edition.to_s if @identifier.edition
|
|
51
|
+
if @identifier.type
|
|
52
|
+
type = @identifier.type&.abbr || @identifier.type.to_s
|
|
53
|
+
segments << type.to_s.downcase if type && type.to_s != "BS"
|
|
54
|
+
end
|
|
55
|
+
# The typed trio's own stage segment (the declared published
|
|
56
|
+
# form): it fires for published rows too — the coded
|
|
57
|
+
# generator's own comparison (a stage_code String is never
|
|
58
|
+
# the :published Symbol).
|
|
59
|
+
code = @identifier.typed_stage&.stage_code
|
|
60
|
+
segments << "stage." + code.to_s if code && code != :published
|
|
50
61
|
segments
|
|
51
62
|
end
|
|
52
63
|
|
|
64
|
+
# An identity attribute of the identifier, or of the document
|
|
65
|
+
# it wraps (the declared root-through): the adoption wrapper
|
|
66
|
+
# carries no identity of its own, so its official segments
|
|
67
|
+
# read the ROOT document's. #root is +self+ for a non-wrapper,
|
|
68
|
+
# so an ordinary identifier reads its own value and nothing
|
|
69
|
+
# changes.
|
|
70
|
+
def identity(attr)
|
|
71
|
+
own = @identifier.public_send(attr)
|
|
72
|
+
return own if own
|
|
73
|
+
|
|
74
|
+
root = @identifier.root
|
|
75
|
+
root.equal?(@identifier) ? nil : root.public_send(attr)
|
|
76
|
+
end
|
|
77
|
+
|
|
53
78
|
# One wrapper's declared URN chain: the kind word, then the
|
|
54
79
|
# wrapper's columns (the ordinal, the year-month date).
|
|
55
80
|
def wrapper_segments(id)
|
data/lib/pubid/iso/CLAUDE.md
CHANGED
|
@@ -228,3 +228,28 @@
|
|
|
228
228
|
non-`Withdrawn` references, 2026-11-14) this was the only failure; the
|
|
229
229
|
`Withdrawn …` rows fail too, but the crawler skips them. Locked by
|
|
230
230
|
`spec/pubid/iso/update_codes_spec.rb`.
|
|
231
|
+
|
|
232
|
+
- **The artifact runs the #118 grammar at parsanol 1.5.1.0 (the fleet
|
|
233
|
+
re-seal's last hold-out, pubid#749).** Grammar#118 (1f84627) added two
|
|
234
|
+
spelling-preserving captures — `nsb_stage_slash` (the WD face's
|
|
235
|
+
stage-to-publisher join: "WD" carries a slash, "Fpr" glues) and
|
|
236
|
+
`tc_join` (the tc_document face's publisher-to-type join, "/" or " ")
|
|
237
|
+
— so the grammar's own render emits the input's join back byte-exactly.
|
|
238
|
+
This builder **decodes** both faces to the canonical form instead, so
|
|
239
|
+
the capture spellings are consumed and dropped: the nsb decode deletes
|
|
240
|
+
`:nsb_stage_slash` beside `:nsb_stage`, and `cast` returns nil for
|
|
241
|
+
`:tc_join`. Without that consumption the ISO `cast`'s unknown-key raise
|
|
242
|
+
(`Unknown parameter type:`) rejects every WD/ISO and tc face — the new
|
|
243
|
+
artifact alone is NOT loadable by the old builder. Net behavior is
|
|
244
|
+
byte-identical to the 1.3.126 bake: all 7,852 stored corpus faces
|
|
245
|
+
replay identically on `to_s`/`to_hash`/URNs (only the raw bound map of
|
|
246
|
+
the two WD faces gains `nsb_stage_slash: "/"`; zero accept deltas).
|
|
247
|
+
The canonical renders: "WD/ISO 10360-2" → "ISO/WD 10360-2",
|
|
248
|
+
"FprISO 105-A03" → "ISO/PRF 105-A03", "ISO TC 46 N 3064" (space join)
|
|
249
|
+
→ "ISO/TC 46 N 3064". Locked by `spec/pubid/iso/nsb_tc_captures_spec.rb`
|
|
250
|
+
(artifact stamp: compiler_version 1.5.1.0 + the #118 source_hash; the
|
|
251
|
+
bound captures; the canonical decodes; from_hash round-trips on all 13
|
|
252
|
+
attested faces). The tc cluster now rides the fixture corpus
|
|
253
|
+
(`identifiers/full/iso-pubid-tc-documents.txt` →
|
|
254
|
+
`pass/tc_document.txt`, 7 faces) and the testsuite exports them as
|
|
255
|
+
`tests/iso/tc_document.yaml` rows.
|
data/lib/pubid/iso/builder.rb
CHANGED
|
@@ -222,6 +222,13 @@ module Pubid
|
|
|
222
222
|
# For NSB-prefixed identifiers (FprISO, WD/ISO), set stage
|
|
223
223
|
if parsed_hash[:nsb_stage]
|
|
224
224
|
nsb_stage = parsed_hash.delete(:nsb_stage)
|
|
225
|
+
# The WD face's stage-to-publisher join captures as
|
|
226
|
+
# nsb_stage_slash (pubid-grammar#118) so the grammar's render
|
|
227
|
+
# can emit the slash face back byte-exactly. This builder
|
|
228
|
+
# decodes to the modern stage face ("WD/ISO 10360-2" renders
|
|
229
|
+
# "ISO/WD 10360-2"), which keeps no spelling, so the join is
|
|
230
|
+
# consumed here and dropped.
|
|
231
|
+
parsed_hash.delete(:nsb_stage_slash)
|
|
225
232
|
# Map NSB stage to typed stage
|
|
226
233
|
case nsb_stage
|
|
227
234
|
when "Fpr"
|
|
@@ -580,6 +587,22 @@ module Pubid
|
|
|
580
587
|
# the Publisher component, so the field assigns nothing.
|
|
581
588
|
nil
|
|
582
589
|
|
|
590
|
+
when :tc_join
|
|
591
|
+
# pubid-grammar#118: the tc_document face's publisher-to-type
|
|
592
|
+
# join ("/" or " ") captures as tc_join so the grammar's render
|
|
593
|
+
# emits the input's own join back (a canonical slash would
|
|
594
|
+
# re-bind a space-joined input to the other alternative). This
|
|
595
|
+
# flavor renders the canonical slash join ("ISO TC 46 N 3064"
|
|
596
|
+
# renders "ISO/TC 46 N 3064"), so the spelling assigns nothing.
|
|
597
|
+
nil
|
|
598
|
+
|
|
599
|
+
when :nsb_stage_slash
|
|
600
|
+
# pubid-grammar#118: reached on paths that skip the nsb_stage
|
|
601
|
+
# decode above (none today — the capture binds only beside
|
|
602
|
+
# nsb_stage), kept total so an unknown bound key stays a
|
|
603
|
+
# consumed no-op instead of a parse failure.
|
|
604
|
+
nil
|
|
605
|
+
|
|
583
606
|
when :supplements
|
|
584
607
|
# Handle bundled supplements (+ operator)
|
|
585
608
|
# Each supplement is a hash that needs to be built
|
data/lib/pubid/version.rb
CHANGED