metanorma-iho 1.4.9 → 1.4.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37838753ccb42360d67701723963b3e5d5957a73c1a71abf0c1149c3bad8861d
4
- data.tar.gz: 0cfdf014198b9904fcc7d6b51c2a1e6cf3d94256b162e38c6a458cf0489e45ce
3
+ metadata.gz: 0f0eb6194ad58902b72b622a70c364a6c8b1f21aaadf4b49b72dc0443cd6a53a
4
+ data.tar.gz: 2ce2393d5ccaa00cb3735a9ac2ab3637abb3081a1528e7e16e48ef47dea31aaf
5
5
  SHA512:
6
- metadata.gz: f9cb469ec176a7908eb76e9a6bfdb010e3f17544ceec55a7d5d713e7fe055970f8248ac94a6ae766831346a56930adadea32b2962d1e7c4d0372ffab0cf8c723
7
- data.tar.gz: 6ac616303ba3b2519394a7fdb0f1ff3e3110bc70ae45d0f937be5c01d866d1e0087ba00b420a0b74e235a7d8b74453138880401c009f146276072f17aa9eeb4f
6
+ metadata.gz: f24588b9fd29907800e9218e1e1792c173b79c1e6971acf49944e408bc7494afd724a943f5f6d6e9b763ee1f1f54353795795f1c66a1257bf12d9d93ac73e053
7
+ data.tar.gz: 5ff763a111a676d0b9eb7dc9bc5b87b2ff43f250be839824c1162c6fe04d0db17c364848c3f51d18882eb7ca5880be88813cfa6dda768559423c4e605f1c9ba2
@@ -38,6 +38,37 @@ module Metanorma
38
38
  metadata_commentperiod(node, ext)
39
39
  end
40
40
 
41
+ # S-158:1xx validation-check specifications carry the product
42
+ # number as a Pubid::Iho `checks_for` member ("S-158:102" is
43
+ # S-158 checks for S-102), not as part of the document number.
44
+ # The :checks-for: document attribute carries it; the identifier is
45
+ # constructed through Pubid::Iho so the face and the MRN URN
46
+ # stay grammar-canonical. Documents without :checks-for: keep the
47
+ # generic docid_template path.
48
+ def metadata_id(node, xml)
49
+ if (id = checks_for_identifier(node))
50
+ # The IHO document face is unprefixed ("S-158:102"); the
51
+ # publisher rides the docidentifier type and the URN.
52
+ urn = id.to_urn
53
+ id.publisher = nil
54
+ add_noko_elem(xml, "docidentifier", id.to_s.strip,
55
+ primary: "true", boilerplate: true,
56
+ type: metadata_id_primary_type(node))
57
+ add_noko_elem(xml, "docidentifier", urn, type: "URN")
58
+ else
59
+ super
60
+ end
61
+ end
62
+
63
+ def checks_for_identifier(node)
64
+ checks_for = node.attr("checks-for") or return nil
65
+ number = node.attr("docnumber") or return nil
66
+ Pubid::Iho::Identifier.parse("S-#{number}:#{checks_for}")
67
+ rescue Pubid::Errors::ParseError
68
+ @log.add("IHO_4", nil, params: [number, checks_for])
69
+ nil
70
+ end
71
+
41
72
  # IHO S-4 documents carry their editorial group as plain attributes:
42
73
  # :committee:/:workgroup: (with _2, _3… suffixes for additional
43
74
  # groups). Emitted into bibdata <ext><editorialgroup>, the shape
@@ -14,6 +14,10 @@ module Metanorma
14
14
  error: "update-unit `%s` does not belong to Part %s " \
15
15
  "of this document",
16
16
  severity: 2 },
17
+ "IHO_4": { category: "AsciiDoc Input",
18
+ error: "`%s:%s` is not a valid S-158:1xx checks-for " \
19
+ "identifier (expected e.g. 158:102)",
20
+ severity: 2 },
17
21
  }.freeze
18
22
  # rubocop:enable Naming/VariableNumber
19
23
 
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Iho
3
- VERSION = "1.4.9".freeze
3
+ VERSION = "1.4.10".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iho
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.9
4
+ version: 1.4.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.