pubid 2.0.0.pre.alpha.1 → 2.0.0.pre.alpha.2

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.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/data/nist/update_codes.yaml +2 -0
  3. data/lib/pubid/amca/identifier.rb +39 -0
  4. data/lib/pubid/ansi/identifier.rb +42 -0
  5. data/lib/pubid/api/identifier.rb +47 -0
  6. data/lib/pubid/ashrae/identifier.rb +39 -0
  7. data/lib/pubid/asme/identifier.rb +46 -0
  8. data/lib/pubid/astm/identifier.rb +77 -0
  9. data/lib/pubid/bsi/identifier.rb +60 -0
  10. data/lib/pubid/ccsds/identifier.rb +68 -0
  11. data/lib/pubid/ccsds/identifiers/base.rb +11 -0
  12. data/lib/pubid/ccsds/single_identifier.rb +4 -1
  13. data/lib/pubid/cen_cenelec/identifier.rb +37 -0
  14. data/lib/pubid/cie/identifier.rb +53 -0
  15. data/lib/pubid/components/factory.rb +50 -0
  16. data/lib/pubid/components/typed_stage.rb +4 -0
  17. data/lib/pubid/components.rb +1 -0
  18. data/lib/pubid/csa/identifier.rb +56 -0
  19. data/lib/pubid/etsi/identifier.rb +43 -0
  20. data/lib/pubid/identifier.rb +8 -1
  21. data/lib/pubid/idf/identifier.rb +60 -0
  22. data/lib/pubid/iec/builder.rb +2 -1
  23. data/lib/pubid/iec/components/code.rb +2 -1
  24. data/lib/pubid/iec/components/publisher.rb +2 -1
  25. data/lib/pubid/iec/identifier.rb +235 -0
  26. data/lib/pubid/iec/identifiers/base.rb +4 -0
  27. data/lib/pubid/iec/identifiers/consolidated_identifier.rb +0 -4
  28. data/lib/pubid/iec/identifiers/fragment_identifier.rb +0 -4
  29. data/lib/pubid/iec/identifiers/sheet_identifier.rb +0 -4
  30. data/lib/pubid/iec/identifiers/vap_identifier.rb +0 -4
  31. data/lib/pubid/iec/parser.rb +7 -2
  32. data/lib/pubid/iec/urn_generator.rb +57 -171
  33. data/lib/pubid/iec/urn_parser.rb +53 -252
  34. data/lib/pubid/ieee/identifier.rb +41 -0
  35. data/lib/pubid/iho/identifier.rb +42 -0
  36. data/lib/pubid/iho/identifiers/base.rb +1 -1
  37. data/lib/pubid/iho/identifiers/bibliographic.rb +0 -4
  38. data/lib/pubid/iho/identifiers/circular_letter.rb +0 -4
  39. data/lib/pubid/iho/identifiers/miscellaneous.rb +0 -4
  40. data/lib/pubid/iho/identifiers/publication.rb +0 -4
  41. data/lib/pubid/iho/identifiers/standard.rb +0 -4
  42. data/lib/pubid/iho/urn_generator.rb +1 -1
  43. data/lib/pubid/iso/builder.rb +5 -1
  44. data/lib/pubid/iso/identifier.rb +261 -0
  45. data/lib/pubid/iso/parser.rb +4 -2
  46. data/lib/pubid/iso/scheme.rb +6 -0
  47. data/lib/pubid/iso/single_identifier.rb +6 -3
  48. data/lib/pubid/iso/urn_generator.rb +17 -3
  49. data/lib/pubid/iso/urn_parser.rb +16 -2
  50. data/lib/pubid/itu/identifier.rb +87 -22
  51. data/lib/pubid/jcgm/identifier.rb +43 -0
  52. data/lib/pubid/jis/identifier.rb +43 -0
  53. data/lib/pubid/nist/builder.rb +174 -5
  54. data/lib/pubid/nist/components/edition.rb +16 -0
  55. data/lib/pubid/nist/components/supplement.rb +88 -21
  56. data/lib/pubid/nist/identifier.rb +62 -0
  57. data/lib/pubid/nist/identifiers/base.rb +103 -24
  58. data/lib/pubid/nist/identifiers/circular_supplement.rb +1 -1
  59. data/lib/pubid/nist/identifiers/crpl_report.rb +1 -4
  60. data/lib/pubid/nist/identifiers/federal_information_processing_standards.rb +10 -0
  61. data/lib/pubid/nist/identifiers/report.rb +1 -2
  62. data/lib/pubid/nist/parser.rb +36 -3
  63. data/lib/pubid/nist/supplement_identifier.rb +8 -24
  64. data/lib/pubid/nist/urn_generator.rb +14 -8
  65. data/lib/pubid/nist.rb +1 -0
  66. data/lib/pubid/oiml/identifier.rb +50 -0
  67. data/lib/pubid/plateau/identifier.rb +57 -0
  68. data/lib/pubid/plateau.rb +1 -0
  69. data/lib/pubid/renderers/base.rb +34 -0
  70. data/lib/pubid/renderers/directives_renderer.rb +13 -14
  71. data/lib/pubid/renderers/guide_renderer.rb +5 -1
  72. data/lib/pubid/renderers/human_readable.rb +20 -8
  73. data/lib/pubid/renderers/iwa_renderer.rb +5 -1
  74. data/lib/pubid/renderers/supplement_renderer.rb +4 -1
  75. data/lib/pubid/rendering/context.rb +5 -2
  76. data/lib/pubid/sae/identifier.rb +23 -0
  77. data/lib/pubid/scheme.rb +12 -0
  78. data/lib/pubid/version.rb +1 -1
  79. metadata +5 -2
@@ -5,7 +5,11 @@ module Pubid
5
5
  class IwaRenderer < HumanReadable
6
6
  def render(context:, with_edition: false)
7
7
  parts = []
8
- parts << @id.typed_stage.render(context:) if @id.typed_stage
8
+ if @id.typed_stage
9
+ parts << annotate(@id.typed_stage.render(context:),
10
+ typed_stage_css(@id.typed_stage),
11
+ annotated: context.annotated)
12
+ end
9
13
  parts << render_number_portion(context)
10
14
  result = parts.compact.join(" ")
11
15
  result << render_language_portion(context, with_edition: with_edition)
@@ -10,9 +10,12 @@ module Pubid
10
10
  with_edition: with_edition,
11
11
  stage_format_long: context.stage_format_long,
12
12
  with_date: context.with_date,
13
+ annotated: context.annotated,
13
14
  )
14
15
 
15
- stage_str = @id.typed_stage.render(context:)
16
+ stage_str = annotate(@id.typed_stage.render(context:),
17
+ typed_stage_css(@id.typed_stage),
18
+ annotated: context.annotated)
16
19
  parts << "#{base_str}/#{stage_str}"
17
20
 
18
21
  num_port = render_number_portion(context)
@@ -22,7 +22,8 @@ module Pubid
22
22
  attr_reader :stage_separator, :stage_separator_with_copublisher,
23
23
  :type_separator, :type_separator_with_prefix,
24
24
  :default_type_abbr, :lang, :lang_single,
25
- :with_language_code, :stage_format_long, :with_date
25
+ :with_language_code, :stage_format_long, :with_date,
26
+ :annotated
26
27
 
27
28
  # Initialize a new rendering context
28
29
  #
@@ -42,7 +43,8 @@ module Pubid
42
43
  lang_single: false,
43
44
  with_language_code: :none,
44
45
  stage_format_long: false,
45
- with_date: true)
46
+ with_date: true,
47
+ annotated: false)
46
48
  @stage_separator = stage_separator
47
49
  @stage_separator_with_copublisher = stage_separator_with_copublisher
48
50
  @type_separator = type_separator
@@ -53,6 +55,7 @@ module Pubid
53
55
  @with_language_code = with_language_code
54
56
  @stage_format_long = stage_format_long
55
57
  @with_date = with_date
58
+ @annotated = annotated
56
59
  end
57
60
 
58
61
  # Get the appropriate stage separator based on whether there's a copublisher
@@ -9,6 +9,29 @@ module Pubid
9
9
  rescue Parslet::ParseFailed => e
10
10
  raise "Failed to parse SAE identifier: #{input}\n#{e.message}"
11
11
  end
12
+
13
+ # Factory that builds a SAE identifier from a hash of primitives.
14
+ # SAE has only one identifier class ({Identifiers::Base}); `:type`
15
+ # is data (the document-type abbreviation: "J", "AS", "ARP", "AMS",
16
+ # "AIR", "MA") rather than a class-dispatch key.
17
+ def self.create(**opts)
18
+ Identifiers::Base.new(**coerce_create_attrs(opts))
19
+ end
20
+
21
+ def self.coerce_create_attrs(opts)
22
+ attrs = { publisher: (opts[:publisher] || "SAE").to_s }
23
+ if (v = opts[:type])
24
+ attrs[:type] = Pubid::Sae::Components::Type.new(abbr: v.to_s)
25
+ end
26
+ if (v = opts[:number])
27
+ attrs[:number] = Pubid::Components::Code.new(value: v.to_s)
28
+ end
29
+ if (v = opts[:year])
30
+ attrs[:date] = Pubid::Components::Date.new(year: v.to_s)
31
+ end
32
+ attrs
33
+ end
34
+ private_class_method :coerce_create_attrs
12
35
  end
13
36
  end
14
37
  end
data/lib/pubid/scheme.rb CHANGED
@@ -131,6 +131,18 @@ module Pubid
131
131
  end
132
132
  end
133
133
 
134
+ # Locate a TypedStage by its unique per-typed-stage code
135
+ # @param code [String, Symbol] The code to find (e.g. :dtr, :fdisp)
136
+ # @return [TypedStage, nil] The matching TypedStage, or nil if not found
137
+ # @note Uses linear search for code lookup
138
+ def locate_typed_stage_by_code(code)
139
+ code_sym = code.to_sym
140
+
141
+ all_typed_stages.detect do |ts|
142
+ ts.code&.to_sym == code_sym
143
+ end
144
+ end
145
+
134
146
  # Locate a TypedStage by harmonized stage code
135
147
  # @param harmonized_code [String] The harmonized stage code to find (e.g., "00.00", "10.00")
136
148
  # @return [TypedStage, nil] The matching TypedStage, or nil if not found
data/lib/pubid/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pubid
4
- VERSION = "2.0.0.pre.alpha.1"
4
+ VERSION = "2.0.0.pre.alpha.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubid
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre.alpha.1
4
+ version: 2.0.0.pre.alpha.2
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-05-21 00:00:00.000000000 Z
11
+ date: 2026-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lutaml-model
@@ -267,6 +267,7 @@ files:
267
267
  - lib/pubid/components/code.rb
268
268
  - lib/pubid/components/date.rb
269
269
  - lib/pubid/components/edition.rb
270
+ - lib/pubid/components/factory.rb
270
271
  - lib/pubid/components/language.rb
271
272
  - lib/pubid/components/locality.rb
272
273
  - lib/pubid/components/publisher.rb
@@ -545,6 +546,7 @@ files:
545
546
  - lib/pubid/nist/components/version.rb
546
547
  - lib/pubid/nist/components/volume.rb
547
548
  - lib/pubid/nist/configuration.rb
549
+ - lib/pubid/nist/identifier.rb
548
550
  - lib/pubid/nist/identifiers.rb
549
551
  - lib/pubid/nist/identifiers/base.rb
550
552
  - lib/pubid/nist/identifiers/circular.rb
@@ -598,6 +600,7 @@ files:
598
600
  - lib/pubid/parsers/mr_string.rb
599
601
  - lib/pubid/plateau.rb
600
602
  - lib/pubid/plateau/builder.rb
603
+ - lib/pubid/plateau/identifier.rb
601
604
  - lib/pubid/plateau/identifiers.rb
602
605
  - lib/pubid/plateau/identifiers/annex.rb
603
606
  - lib/pubid/plateau/identifiers/base.rb