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 +4 -4
- data/lib/metanorma/iho/front.rb +31 -0
- data/lib/metanorma/iho/log.rb +4 -0
- data/lib/metanorma/iho/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0f0eb6194ad58902b72b622a70c364a6c8b1f21aaadf4b49b72dc0443cd6a53a
|
|
4
|
+
data.tar.gz: 2ce2393d5ccaa00cb3735a9ac2ab3637abb3081a1528e7e16e48ef47dea31aaf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f24588b9fd29907800e9218e1e1792c173b79c1e6971acf49944e408bc7494afd724a943f5f6d6e9b763ee1f1f54353795795f1c66a1257bf12d9d93ac73e053
|
|
7
|
+
data.tar.gz: 5ff763a111a676d0b9eb7dc9bc5b87b2ff43f250be839824c1162c6fe04d0db17c364848c3f51d18882eb7ca5880be88813cfa6dda768559423c4e605f1c9ba2
|
data/lib/metanorma/iho/front.rb
CHANGED
|
@@ -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
|
data/lib/metanorma/iho/log.rb
CHANGED
|
@@ -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
|
|