pubid 2.0.8 → 2.0.10

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 (59) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +2 -1
  3. data/data/parg/sae.json +1 -1
  4. data/lib/pubid/adobe/pubid_urn_schema.rb +14 -0
  5. data/lib/pubid/adobe.rb +1 -0
  6. data/lib/pubid/api/pubid_urn_schema.rb +2 -0
  7. data/lib/pubid/calconnect/pubid_urn_schema.rb +20 -0
  8. data/lib/pubid/calconnect.rb +1 -0
  9. data/lib/pubid/ccsds/pubid_urn_schema.rb +22 -0
  10. data/lib/pubid/ccsds.rb +1 -0
  11. data/lib/pubid/cen_cenelec/CLAUDE.md +17 -0
  12. data/lib/pubid/cen_cenelec/identifiers/cenelec_harmonization_document.rb +4 -1
  13. data/lib/pubid/cen_cenelec/identifiers.rb +1 -1
  14. data/lib/pubid/cen_cenelec/pubid_urn_schema.rb +35 -0
  15. data/lib/pubid/cen_cenelec.rb +1 -0
  16. data/lib/pubid/easc/pubid_urn_schema.rb +20 -0
  17. data/lib/pubid/easc.rb +1 -0
  18. data/lib/pubid/ecma/pubid_urn_schema.rb +21 -0
  19. data/lib/pubid/ecma.rb +1 -0
  20. data/lib/pubid/etsi/CLAUDE.md +9 -0
  21. data/lib/pubid/etsi/pubid_urn_schema.rb +36 -0
  22. data/lib/pubid/etsi.rb +1 -0
  23. data/lib/pubid/evs/pubid_urn_schema.rb +35 -0
  24. data/lib/pubid/evs.rb +1 -0
  25. data/lib/pubid/gost/CLAUDE.md +12 -0
  26. data/lib/pubid/gost/pubid_urn_schema.rb +34 -0
  27. data/lib/pubid/gost.rb +1 -0
  28. data/lib/pubid/iala/pubid_urn_schema.rb +30 -0
  29. data/lib/pubid/iala.rb +1 -0
  30. data/lib/pubid/iana/pubid_urn_schema.rb +17 -0
  31. data/lib/pubid/iana.rb +1 -0
  32. data/lib/pubid/identifier.rb +7 -1
  33. data/lib/pubid/iec/pubid_urn_schema.rb +11 -4
  34. data/lib/pubid/oasis/pubid_urn_schema.rb +21 -0
  35. data/lib/pubid/oasis.rb +1 -0
  36. data/lib/pubid/ogc/pubid_urn_schema.rb +18 -0
  37. data/lib/pubid/ogc.rb +1 -0
  38. data/lib/pubid/plateau/CLAUDE.md +13 -0
  39. data/lib/pubid/plateau/pubid_urn_schema.rb +25 -0
  40. data/lib/pubid/plateau.rb +1 -0
  41. data/lib/pubid/pubid_urn/decoder.rb +8 -2
  42. data/lib/pubid/pubid_urn/encoder.rb +14 -2
  43. data/lib/pubid/pubid_urn/schema.rb +18 -4
  44. data/lib/pubid/pubid_urn.rb +40 -0
  45. data/lib/pubid/sae/CLAUDE.md +78 -0
  46. data/lib/pubid/sae/builder.rb +89 -11
  47. data/lib/pubid/sae/components/date.rb +12 -3
  48. data/lib/pubid/sae/components/type.rb +54 -2
  49. data/lib/pubid/sae/identifiers/base.rb +54 -1
  50. data/lib/pubid/sae/renderer.rb +17 -20
  51. data/lib/pubid/sae/urn_generator.rb +6 -1
  52. data/lib/pubid/sae/urn_parser.rb +8 -3
  53. data/lib/pubid/version.rb +1 -1
  54. data/lib/pubid/w3c/pubid_urn_schema.rb +27 -0
  55. data/lib/pubid/w3c.rb +1 -0
  56. data/lib/pubid/xsf/pubid_urn_schema.rb +14 -0
  57. data/lib/pubid/xsf.rb +1 -0
  58. data/lib/pubid.rb +20 -0
  59. metadata +20 -2
@@ -2,34 +2,31 @@
2
2
 
3
3
  module Pubid
4
4
  module Sae
5
- # Human-readable renderer for SAE identifiers.
5
+ # Human-readable renderer for SAE identifiers, in the form SAE prints:
6
6
  #
7
- # Produces strings like:
8
- # "SAE AS5553"
9
- # "SAE ARP4754A"
10
- # "SAE AMS2475:2023"
7
+ # "SAE J3016" "SAE AMS4121J"
8
+ # "SAE J3016_202104" "SAE ARP4754A:2010"
9
+ # "SAE AS22520/45A" "SAE AMS-QQ-A-250/4B"
10
+ # "SAE AS5259/7A_A1" "SAE USCAR-2-6"
11
11
  #
12
- # The renderer is registered as the +:human+ format in the SAE format
13
- # registry and invoked via +render(format: :human)+.
12
+ # A dated edition with a month renders SAE's native edition code
13
+ # (+_YYYYMM+); a year alone renders +:YYYY+.
14
14
  class Renderer < ::Pubid::Renderers::Base
15
15
  def render(context: nil, **_opts)
16
16
  id = @id
17
+ type = id.type
18
+ code = type ? "#{type.abbr}#{type.separator}" : ""
19
+ result = [id.publisher, code + id.designation].compact.join(" ")
20
+ result + date_suffix(id, context)
21
+ end
17
22
 
18
- parts = []
19
-
20
- # Publisher and type
21
- parts << id.publisher if id.publisher
22
- parts << id.type.to_s if id.type
23
-
24
- # Number
25
- parts << id.number.to_s if id.number
26
-
27
- result = parts.join(" ")
23
+ private
28
24
 
29
- # Date
30
- result += ":#{id.date.render(context:)}" if id.date
25
+ def date_suffix(id, context)
26
+ return "" unless id.date&.year
31
27
 
32
- result
28
+ separator = id.date.month ? "_" : ":"
29
+ "#{separator}#{id.date.render(context:)}"
33
30
  end
34
31
  end
35
32
  end
@@ -2,6 +2,11 @@
2
2
 
3
3
  module Pubid
4
4
  module Sae
5
+ # urn:sae:{type|std}:{designation}[:{yyyy|yyyymm}]
6
+ #
7
+ # The designation is the printed code after the type (Identifier#
8
+ # designation): "4121J", "22520/45A", "5259/7A_A1". The date segment is
9
+ # the year, or SAE's year-and-month edition date.
5
10
  class UrnGenerator < Pubid::UrnGenerator::Base
6
11
  def urn_type
7
12
  return "std" unless identifier.type
@@ -12,7 +17,7 @@ module Pubid
12
17
  def urn_number
13
18
  return nil unless identifier.number
14
19
 
15
- identifier.number.to_s
20
+ identifier.designation
16
21
  end
17
22
 
18
23
  def generate
@@ -5,7 +5,7 @@ module Pubid
5
5
  # Parses SAE URNs back into identifiers.
6
6
  #
7
7
  # UrnGenerator emits:
8
- # urn:sae:{type|std}:{number}:{year}
8
+ # urn:sae:{type|std}:{designation}[:{yyyy|yyyymm}]
9
9
  # where slot[1] is overwritten with the publisher string when a publisher
10
10
  # is set. The common single-publisher case keeps slot[1] = "sae".
11
11
  #
@@ -25,10 +25,15 @@ module Pubid
25
25
 
26
26
  private
27
27
 
28
+ # The designation follows the type with no separator; the grammar
29
+ # reads a glued number for every family. A six-digit date segment is
30
+ # SAE's year-and-month edition date.
28
31
  def build_text(type_token, number, year)
29
32
  head = type_token == "std" ? "" : type_token.upcase
30
- text = "SAE #{head}#{number}"
31
- text += ":#{year}" if year
33
+ # The designation's letters are upper-case in every SAE code; a URN
34
+ # that a consumer lower-cased (urn:sae:ams:4121j) still resolves.
35
+ text = "SAE #{head}#{number.to_s.upcase}"
36
+ text += "#{year.to_s.length == 6 ? '_' : ':'}#{year}" if year
32
37
  text
33
38
  end
34
39
  end
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.8"
4
+ VERSION = "2.0.10"
5
5
  end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pubid
4
+ module W3c
5
+ # The pubid-scheme URN of w3c (issue #656; docs/URN-SCHEMES.adoc).
6
+ #
7
+ # Declared from the doc's section: the atom, facet and type tables
8
+ # below are the doc's design, conforming token-for-token.
9
+ PubidUrnSchema = Pubid::PubidUrn.define("w3c") do
10
+ atom "date", "date"
11
+
12
+
13
+ type "pubid:w3c:candidate-recommendation", "cr"
14
+ type "pubid:w3c:candidate-recommendation-draft", "crd"
15
+ type "pubid:w3c:draft-note", "dn"
16
+ type "pubid:w3c:identifier", "id"
17
+ type "pubid:w3c:note", "note"
18
+ type "pubid:w3c:obsolete-recommendation", "or"
19
+ type "pubid:w3c:proposed-edited-recommendation", "per"
20
+ type "pubid:w3c:proposed-recommendation", "pr"
21
+ type "pubid:w3c:recommendation", "rec"
22
+ type "pubid:w3c:standard", "std"
23
+ type "pubid:w3c:superseded-recommendation", "sr"
24
+ type "pubid:w3c:working-draft", "wd"
25
+ end
26
+ end
27
+ end
data/lib/pubid/w3c.rb CHANGED
@@ -16,6 +16,7 @@ module Pubid
16
16
  autoload :Renderer, "#{__dir__}/w3c/renderer"
17
17
  autoload :UrnGenerator, "#{__dir__}/w3c/urn_generator"
18
18
  autoload :UrnParser, "#{__dir__}/w3c/urn_parser"
19
+ autoload :PubidUrnSchema, "#{__dir__}/w3c/pubid_urn_schema"
19
20
 
20
21
  # Parse a W3C identifier string
21
22
  def self.parse(identifier)
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pubid
4
+ module Xsf
5
+ # The pubid-scheme URN of xsf (issue #656; docs/URN-SCHEMES.adoc).
6
+ #
7
+ # Declared from the doc's section: the atom, facet and type tables
8
+ # below are the doc's design, conforming token-for-token.
9
+ PubidUrnSchema = Pubid::PubidUrn.define("xsf") do
10
+ type "pubid:xsf:identifier", "id"
11
+ type "pubid:xsf:xep", "xep"
12
+ end
13
+ end
14
+ end
data/lib/pubid/xsf.rb CHANGED
@@ -21,6 +21,7 @@ module Pubid
21
21
  autoload :Renderer, "#{__dir__}/xsf/renderer"
22
22
  autoload :UrnGenerator, "#{__dir__}/xsf/urn_generator"
23
23
  autoload :UrnParser, "#{__dir__}/xsf/urn_parser"
24
+ autoload :PubidUrnSchema, "#{__dir__}/xsf/pubid_urn_schema"
24
25
 
25
26
  # Parse an XSF identifier string
26
27
  def self.parse(identifier)
data/lib/pubid.rb CHANGED
@@ -300,6 +300,26 @@ module Pubid
300
300
  urn_parser.parse(string)
301
301
  end
302
302
 
303
+ # The slug form (relaton#441): the pubid-scheme URN of +source+ in
304
+ # HTTP-path clothes — "/"-joined segments after the "urn:pubid:"
305
+ # prefix ("iso/is/9001/year-2015"). Bijective with
306
+ # {PubidUrn.from_slug}.
307
+ #
308
+ # @param source [Identifier, String] an identifier or its pubid-scheme URN
309
+ # @return [String]
310
+ def self.to_slug(source)
311
+ PubidUrn.to_slug(source)
312
+ end
313
+
314
+ # Parse a slug (see {PubidUrn.from_slug}).
315
+ #
316
+ # @param string [String] the slug
317
+ # @return [Identifier]
318
+ def self.from_slug(string)
319
+ eager_load_flavors!
320
+ PubidUrn.from_slug(string)
321
+ end
322
+
303
323
  # Parse a pubid-scheme URN, and only that: an official URN such as
304
324
  # "urn:iso:std:…" raises. For a consumer that takes a slug and must not
305
325
  # accept a lossy official URN by mistake (relaton/relaton#441).
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.8
4
+ version: 2.0.10
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-04 00:00:00.000000000 Z
11
+ date: 2026-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lutaml-model
@@ -142,6 +142,7 @@ files:
142
142
  - lib/pubid/adobe/identifiers/publication.rb
143
143
  - lib/pubid/adobe/identifiers/tech_note.rb
144
144
  - lib/pubid/adobe/parser.rb
145
+ - lib/pubid/adobe/pubid_urn_schema.rb
145
146
  - lib/pubid/adobe/renderer.rb
146
147
  - lib/pubid/adobe/urn_generator.rb
147
148
  - lib/pubid/adobe/urn_parser.rb
@@ -325,6 +326,7 @@ files:
325
326
  - lib/pubid/calconnect/identifiers.rb
326
327
  - lib/pubid/calconnect/identifiers/standard.rb
327
328
  - lib/pubid/calconnect/parser.rb
329
+ - lib/pubid/calconnect/pubid_urn_schema.rb
328
330
  - lib/pubid/calconnect/renderer.rb
329
331
  - lib/pubid/calconnect/urn_generator.rb
330
332
  - lib/pubid/calconnect/urn_parser.rb
@@ -335,6 +337,7 @@ files:
335
337
  - lib/pubid/ccsds/identifiers/base.rb
336
338
  - lib/pubid/ccsds/identifiers/corrigendum.rb
337
339
  - lib/pubid/ccsds/parser.rb
340
+ - lib/pubid/ccsds/pubid_urn_schema.rb
338
341
  - lib/pubid/ccsds/single_identifier.rb
339
342
  - lib/pubid/ccsds/supplement_identifier.rb
340
343
  - lib/pubid/ccsds/urn_generator.rb
@@ -361,6 +364,7 @@ files:
361
364
  - lib/pubid/cen_cenelec/identifiers/technical_report.rb
362
365
  - lib/pubid/cen_cenelec/identifiers/technical_specification.rb
363
366
  - lib/pubid/cen_cenelec/parser.rb
367
+ - lib/pubid/cen_cenelec/pubid_urn_schema.rb
364
368
  - lib/pubid/cen_cenelec/renderer.rb
365
369
  - lib/pubid/cen_cenelec/single_identifier.rb
366
370
  - lib/pubid/cen_cenelec/urn_generator.rb
@@ -449,6 +453,7 @@ files:
449
453
  - lib/pubid/easc/identifiers/pmg.rb
450
454
  - lib/pubid/easc/identifiers/rmg.rb
451
455
  - lib/pubid/easc/parser.rb
456
+ - lib/pubid/easc/pubid_urn_schema.rb
452
457
  - lib/pubid/easc/renderer.rb
453
458
  - lib/pubid/easc/urn_generator.rb
454
459
  - lib/pubid/easc/urn_parser.rb
@@ -461,6 +466,7 @@ files:
461
466
  - lib/pubid/ecma/identifiers/standard.rb
462
467
  - lib/pubid/ecma/identifiers/technical_report.rb
463
468
  - lib/pubid/ecma/parser.rb
469
+ - lib/pubid/ecma/pubid_urn_schema.rb
464
470
  - lib/pubid/ecma/renderer.rb
465
471
  - lib/pubid/ecma/urn_generator.rb
466
472
  - lib/pubid/ecma/urn_parser.rb
@@ -479,6 +485,7 @@ files:
479
485
  - lib/pubid/etsi/identifiers/etsi_standard.rb
480
486
  - lib/pubid/etsi/identifiers/supplement_identifier.rb
481
487
  - lib/pubid/etsi/parser.rb
488
+ - lib/pubid/etsi/pubid_urn_schema.rb
482
489
  - lib/pubid/etsi/renderer.rb
483
490
  - lib/pubid/etsi/urn_generator.rb
484
491
  - lib/pubid/etsi/urn_parser.rb
@@ -491,6 +498,7 @@ files:
491
498
  - lib/pubid/evs/identifiers/international_adoption.rb
492
499
  - lib/pubid/evs/identifiers/national_adoption.rb
493
500
  - lib/pubid/evs/parser.rb
501
+ - lib/pubid/evs/pubid_urn_schema.rb
494
502
  - lib/pubid/evs/renderer.rb
495
503
  - lib/pubid/evs/urn_generator.rb
496
504
  - lib/pubid/evs/urn_parser.rb
@@ -521,6 +529,7 @@ files:
521
529
  - lib/pubid/gost/identifiers/interstate_standard.rb
522
530
  - lib/pubid/gost/identifiers/national_standard.rb
523
531
  - lib/pubid/gost/parser.rb
532
+ - lib/pubid/gost/pubid_urn_schema.rb
524
533
  - lib/pubid/gost/renderer.rb
525
534
  - lib/pubid/gost/urn_generator.rb
526
535
  - lib/pubid/gost/urn_parser.rb
@@ -541,6 +550,7 @@ files:
541
550
  - lib/pubid/iala/identifiers/resolution.rb
542
551
  - lib/pubid/iala/identifiers/standard.rb
543
552
  - lib/pubid/iala/parser.rb
553
+ - lib/pubid/iala/pubid_urn_schema.rb
544
554
  - lib/pubid/iala/renderer.rb
545
555
  - lib/pubid/iala/urn_generator.rb
546
556
  - lib/pubid/iala/urn_parser.rb
@@ -551,6 +561,7 @@ files:
551
561
  - lib/pubid/iana/identifiers.rb
552
562
  - lib/pubid/iana/identifiers/registry.rb
553
563
  - lib/pubid/iana/parser.rb
564
+ - lib/pubid/iana/pubid_urn_schema.rb
554
565
  - lib/pubid/iana/renderer.rb
555
566
  - lib/pubid/iana/urn_generator.rb
556
567
  - lib/pubid/iana/urn_parser.rb
@@ -884,6 +895,7 @@ files:
884
895
  - lib/pubid/oasis/identifiers.rb
885
896
  - lib/pubid/oasis/identifiers/standard.rb
886
897
  - lib/pubid/oasis/parser.rb
898
+ - lib/pubid/oasis/pubid_urn_schema.rb
887
899
  - lib/pubid/oasis/renderer.rb
888
900
  - lib/pubid/oasis/urn_generator.rb
889
901
  - lib/pubid/oasis/urn_parser.rb
@@ -894,6 +906,7 @@ files:
894
906
  - lib/pubid/ogc/identifiers.rb
895
907
  - lib/pubid/ogc/identifiers/document.rb
896
908
  - lib/pubid/ogc/parser.rb
909
+ - lib/pubid/ogc/pubid_urn_schema.rb
897
910
  - lib/pubid/ogc/renderer.rb
898
911
  - lib/pubid/ogc/urn_generator.rb
899
912
  - lib/pubid/ogc/urn_parser.rb
@@ -943,6 +956,7 @@ files:
943
956
  - lib/pubid/parsers/urn.rb
944
957
  - lib/pubid/pg.rb
945
958
  - lib/pubid/plateau.rb
959
+ - lib/pubid/plateau/CLAUDE.md
946
960
  - lib/pubid/plateau/builder.rb
947
961
  - lib/pubid/plateau/identifier.rb
948
962
  - lib/pubid/plateau/identifiers.rb
@@ -951,6 +965,7 @@ files:
951
965
  - lib/pubid/plateau/identifiers/handbook.rb
952
966
  - lib/pubid/plateau/identifiers/technical_report.rb
953
967
  - lib/pubid/plateau/parser.rb
968
+ - lib/pubid/plateau/pubid_urn_schema.rb
954
969
  - lib/pubid/plateau/renderer.rb
955
970
  - lib/pubid/plateau/supplement_identifier.rb
956
971
  - lib/pubid/plateau/urn_generator.rb
@@ -982,6 +997,7 @@ files:
982
997
  - lib/pubid/rendering/stage.rb
983
998
  - lib/pubid/rendering/supplement.rb
984
999
  - lib/pubid/sae.rb
1000
+ - lib/pubid/sae/CLAUDE.md
985
1001
  - lib/pubid/sae/builder.rb
986
1002
  - lib/pubid/sae/components.rb
987
1003
  - lib/pubid/sae/components/code.rb
@@ -1044,6 +1060,7 @@ files:
1044
1060
  - lib/pubid/w3c/identifiers/superseded_recommendation.rb
1045
1061
  - lib/pubid/w3c/identifiers/working_draft.rb
1046
1062
  - lib/pubid/w3c/parser.rb
1063
+ - lib/pubid/w3c/pubid_urn_schema.rb
1047
1064
  - lib/pubid/w3c/renderer.rb
1048
1065
  - lib/pubid/w3c/urn_generator.rb
1049
1066
  - lib/pubid/w3c/urn_parser.rb
@@ -1054,6 +1071,7 @@ files:
1054
1071
  - lib/pubid/xsf/identifiers.rb
1055
1072
  - lib/pubid/xsf/identifiers/xep.rb
1056
1073
  - lib/pubid/xsf/parser.rb
1074
+ - lib/pubid/xsf/pubid_urn_schema.rb
1057
1075
  - lib/pubid/xsf/renderer.rb
1058
1076
  - lib/pubid/xsf/urn_generator.rb
1059
1077
  - lib/pubid/xsf/urn_parser.rb