metanorma-iho 1.4.1 → 1.4.3
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/Gemfile +3 -4
- data/lib/metanorma/iho/citation_style.rb +1 -1
- data/lib/metanorma/iho/cleanup.rb +8 -3
- data/lib/metanorma/iho/converter.rb +35 -0
- data/lib/metanorma/iho/front.rb +35 -0
- data/lib/metanorma/iho/html/renderer.rb +4 -1
- data/lib/metanorma/iho/m3_stages.rb +37 -0
- data/lib/metanorma/iho/version.rb +1 -1
- data/lib/metanorma/iho.rb +1 -0
- data/metanorma-iho.gemspec +1 -2
- data/metanorma.yml +2 -0
- metadata +7 -20
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7e47e28ea024b8de6f8c7ffa8494f820dc0b085de8e8583fc68b05868dcd6ff8
|
|
4
|
+
data.tar.gz: 34bf90352d30b8799e28fc1a2f36b68d38cc1bb178622a4c5d97a2e50572bf15
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b2c5c07e3394a6753824be091cc09cd81a77d1b0e89a58177d1394e2f3c158a0189dbbbb252eff00124db1ea37008f058a4abaf83e66c1c859b963ef9006f6c6
|
|
7
|
+
data.tar.gz: 3c07104021dabcca471db89fde4ce63a4efb891160b3ded2369a53cd8b78730dd0902e1e5fb942b2dd101bc07ac4341a3878dc80e7e14d33779f2ff23836d44e
|
data/Gemfile
CHANGED
|
@@ -5,11 +5,10 @@ gemspec
|
|
|
5
5
|
|
|
6
6
|
# canonical line: relaton 3 finals over the α engine line
|
|
7
7
|
gem "pubid", "~> 2.0"
|
|
8
|
-
gem "
|
|
9
|
-
gem "isodoc", "~> 3.7.4.pre.alpha"
|
|
8
|
+
gem "isodoc", "~> 3.7.9"
|
|
10
9
|
gem "isodoc-i18n", github: "metanorma/isodoc-i18n", branch: "main"
|
|
11
|
-
gem "metanorma-standoc", "~> 3.5.
|
|
12
|
-
gem "metanorma-document", "~> 0.5.
|
|
10
|
+
gem "metanorma-standoc", "~> 3.5.7"
|
|
11
|
+
gem "metanorma-document", "~> 0.5.3"
|
|
13
12
|
gem "metanorma-core", github: "metanorma/metanorma-core", branch: "main"
|
|
14
13
|
gem "metanorma-iso", github: "metanorma/metanorma-iso", branch: "main"
|
|
15
14
|
gem "metanorma-generic", github: "metanorma/metanorma-generic", branch: "main"
|
|
@@ -10,16 +10,21 @@ module Metanorma
|
|
|
10
10
|
|
|
11
11
|
def bibdata_docidentifier_i18n(isoxml)
|
|
12
12
|
id, parts = bibdata_docidentifier_i18n_prep(isoxml)
|
|
13
|
-
parts.empty? and return
|
|
13
|
+
(parts.empty? || id.nil?) and return
|
|
14
14
|
id_alt = id.dup
|
|
15
15
|
id.next = id_alt
|
|
16
|
-
id_alt["type"] = "
|
|
16
|
+
id["type"] and id_alt["type"] = "#{id["type"]}-parent-document"
|
|
17
17
|
id_alt.delete("primary")
|
|
18
18
|
bibdata_docidentifier_enhance(id, parts)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def bibdata_docidentifier_i18n_prep(isoxml)
|
|
22
|
-
|
|
22
|
+
# Mutate the identifier the document actually carries
|
|
23
|
+
# (metanorma-iho#577): a document compiled under a taste carries
|
|
24
|
+
# that taste's organisation type on its primary docidentifier,
|
|
25
|
+
# so a hardcoded type string is not a legal match key.
|
|
26
|
+
id = isoxml.at("//bibdata/docidentifier[@primary = 'true']") ||
|
|
27
|
+
isoxml.at("//bibdata/docidentifier")
|
|
23
28
|
parts = %w(appendixid annexid part supplementid)
|
|
24
29
|
.each_with_object({}) do |w, m|
|
|
25
30
|
dn = isoxml.at("//bibdata/ext/structuredidentifier/#{w}") and
|
|
@@ -15,6 +15,41 @@ module Metanorma
|
|
|
15
15
|
Metanorma::Iho.configuration
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
+
# A taste registers its own vocabulary through its metanorma.yml,
|
|
19
|
+
# handed to the converter as the :customize: document attribute
|
|
20
|
+
# (metanorma-iho#578). The generic implementation files it under
|
|
21
|
+
# the generic flavour's configuration, which nothing on this
|
|
22
|
+
# flavour's path reads: file it under this flavour's
|
|
23
|
+
# configuration instead, and re-register this flavour's
|
|
24
|
+
# processor. The taste's doctype vocabulary extends the base's
|
|
25
|
+
# rather than replacing it: a document of the base vocabulary
|
|
26
|
+
# stays legal under a taste that declares its own.
|
|
27
|
+
def read_config_file(path_to_config_file)
|
|
28
|
+
base_doctypes = configuration.doctypes || {}
|
|
29
|
+
configuration.set_default_values_from_yaml_file(path_to_config_file)
|
|
30
|
+
taste_doctypes = configuration.doctypes and
|
|
31
|
+
configuration.doctypes = base_doctypes.merge(taste_doctypes)
|
|
32
|
+
Metanorma::Registry.instance.register(Metanorma::Iho::Processor)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# IHO M-3 (2026) development-stage vocabulary (metanorma-iho#553):
|
|
36
|
+
# a `:status:` value may be the stage slug or its M-3 abbreviation;
|
|
37
|
+
# both normalize to the slug with the abbreviation carried on the
|
|
38
|
+
# stage element. Values outside the M-3 vocabulary pass through
|
|
39
|
+
# unchanged (in-force, draft, ...).
|
|
40
|
+
def metadata_status(node, xml)
|
|
41
|
+
return super unless node.attr("status")
|
|
42
|
+
|
|
43
|
+
stage, abbr = M3Stages.normalize(node.attr("status"))
|
|
44
|
+
abbr ||= node.attr("docstage-abbrev")
|
|
45
|
+
xml.status do |s|
|
|
46
|
+
add_noko_elem(s, "stage", stage, abbreviation: abbr)
|
|
47
|
+
add_noko_elem(s, "substage", node.attr("docsubstage") ||
|
|
48
|
+
node.attr("substage"))
|
|
49
|
+
add_noko_elem(s, "iteration", node.attr("iteration"))
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
18
53
|
def presentation_xml_converter(node)
|
|
19
54
|
IsoDoc::Iho::PresentationXMLConvert
|
|
20
55
|
.new(html_extract_attributes(node)
|
data/lib/metanorma/iho/front.rb
CHANGED
|
@@ -17,6 +17,16 @@ module Metanorma
|
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
+
# The :urn: document attribute carries the document's URN; bibdata
|
|
21
|
+
# keeps it as a typed uri (metanorma-iho#579). Generating the URN
|
|
22
|
+
# through pubid belongs to the consuming taste; this is the
|
|
23
|
+
# generic attribute-to-bibdata propagation, inert when the
|
|
24
|
+
# attribute is absent.
|
|
25
|
+
def metadata_source(node, xml)
|
|
26
|
+
super
|
|
27
|
+
add_noko_elem(xml, "uri", node.attr("urn"), type: "urn")
|
|
28
|
+
end
|
|
29
|
+
|
|
20
30
|
def metadata_ext(node, ext)
|
|
21
31
|
# Compile probes run the converter on bare internal documents
|
|
22
32
|
# without user attributes; only warn on real document headers.
|
|
@@ -24,9 +34,34 @@ module Metanorma
|
|
|
24
34
|
@log.add("IHO_1", nil)
|
|
25
35
|
end
|
|
26
36
|
super
|
|
37
|
+
metadata_committee(node, ext)
|
|
27
38
|
metadata_commentperiod(node, ext)
|
|
28
39
|
end
|
|
29
40
|
|
|
41
|
+
# IHO S-4 documents carry their editorial group as plain attributes:
|
|
42
|
+
# :committee:/:workgroup: (with _2, _3… suffixes for additional
|
|
43
|
+
# groups). Emitted into bibdata <ext><editorialgroup>, the shape
|
|
44
|
+
# relaton's IHO hash parser normalizes
|
|
45
|
+
# (relaton/iho/hash_parser_v1#editorialgroup_hash_to_bib). The
|
|
46
|
+
# emission was dropped in d1af149 as an IEC-motivated ride-along
|
|
47
|
+
# (metanorma-iec#191); IHO genuinely uses it.
|
|
48
|
+
def metadata_committee(node, xml)
|
|
49
|
+
node.attr("workgroup") or return
|
|
50
|
+
i = 1
|
|
51
|
+
while node.attr("workgroup#{i == 1 ? "" : "_#{i}"}")
|
|
52
|
+
sfx = i == 1 ? "" : "_#{i}"
|
|
53
|
+
xml.editorialgroup do |a|
|
|
54
|
+
a.committee do |n|
|
|
55
|
+
n.abbreviation node.attr("committee#{sfx}").to_s.upcase
|
|
56
|
+
end
|
|
57
|
+
a.workgroup do |n|
|
|
58
|
+
n.abbreviation node.attr("workgroup#{sfx}").upcase
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
i += 1
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
30
65
|
def metadata_commentperiod(node, xml)
|
|
31
66
|
from = node.attr("comment-from") or return
|
|
32
67
|
xml.commentperiod do |c|
|
|
@@ -78,7 +78,10 @@ module Metanorma
|
|
|
78
78
|
text = Array(element.value).join.strip
|
|
79
79
|
return nil if text.empty?
|
|
80
80
|
|
|
81
|
-
text.split("-").map(&:capitalize).join(" ")
|
|
81
|
+
label = text.split("-").map(&:capitalize).join(" ")
|
|
82
|
+
abbr = element.respond_to?(:abbreviation) ? element.abbreviation : nil
|
|
83
|
+
abbr = Array(abbr).filter_map { |a| a.respond_to?(:value) ? Array(a.value).join.strip : nil }.first
|
|
84
|
+
abbr && !abbr.empty? ? "#{label} (#{abbr})" : label
|
|
82
85
|
end
|
|
83
86
|
|
|
84
87
|
def iho_copyright_line(bibdata)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Metanorma
|
|
4
|
+
module Iho
|
|
5
|
+
# IHO M-3 (2026 edition), "Principles and procedures for making changes
|
|
6
|
+
# to IHO technical standards and specifications", document development
|
|
7
|
+
# stages (p. 68). A `:status:` value may be given as the stage slug or
|
|
8
|
+
# as its M-3 abbreviation; both normalize to the slug plus the
|
|
9
|
+
# abbreviation, which is carried on the bibdata stage element so the
|
|
10
|
+
# development stage is identifiable in the rendered document.
|
|
11
|
+
module M3Stages
|
|
12
|
+
STAGES = {
|
|
13
|
+
"concept-proposal" => "CP",
|
|
14
|
+
"proposal-development" => "PD",
|
|
15
|
+
"working-draft" => "WD",
|
|
16
|
+
"endorsement-draft" => "ED",
|
|
17
|
+
"approval-draft" => "AD",
|
|
18
|
+
}.freeze
|
|
19
|
+
|
|
20
|
+
# Returns [stage, abbreviation]. Values outside the M-3 2026
|
|
21
|
+
# vocabulary pass through unchanged with no abbreviation, preserving
|
|
22
|
+
# the pre-M-3 2026 statuses (in-force, draft, ...).
|
|
23
|
+
def self.normalize(value)
|
|
24
|
+
raw = value.to_s.strip
|
|
25
|
+
return [nil, nil] if raw.empty?
|
|
26
|
+
|
|
27
|
+
slug = raw.downcase.tr(" ", "-").tr("_", "-")
|
|
28
|
+
return [slug, STAGES[slug]] if STAGES.key?(slug)
|
|
29
|
+
|
|
30
|
+
hit = STAGES.find { |_s, abbr| abbr.casecmp(raw).zero? }
|
|
31
|
+
return [hit[0], hit[1]] if hit
|
|
32
|
+
|
|
33
|
+
[raw, nil]
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
data/lib/metanorma/iho.rb
CHANGED
data/metanorma-iho.gemspec
CHANGED
|
@@ -27,10 +27,9 @@ Gem::Specification.new do |spec|
|
|
|
27
27
|
spec.require_paths = ["lib"]
|
|
28
28
|
spec.required_ruby_version = Gem::Requirement.new(">= 3.3.0")
|
|
29
29
|
|
|
30
|
-
spec.add_dependency "metanorma-generic", "
|
|
30
|
+
spec.add_dependency "metanorma-generic", "~> 3.5.1"
|
|
31
31
|
|
|
32
32
|
spec.add_development_dependency "debug"
|
|
33
|
-
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
|
34
33
|
spec.add_development_dependency "guard", "~> 2.14"
|
|
35
34
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
|
36
35
|
spec.add_development_dependency "rake", "~> 13.0"
|
data/metanorma.yml
CHANGED
|
@@ -12,6 +12,8 @@ committees:
|
|
|
12
12
|
full_name: Inter-Regional Coordination Committee
|
|
13
13
|
- code: ihb
|
|
14
14
|
full_name: International Hydrographic Bureau
|
|
15
|
+
- code: ncwg
|
|
16
|
+
full_name: Nautical Cartography Working Group
|
|
15
17
|
htmlcoverpage: lib/isodoc/iho/html/html_iho_titlepage.html
|
|
16
18
|
htmlintropage: lib/isodoc/iho/html/html_iho_intro.html
|
|
17
19
|
htmlstylesheet: lib/isodoc/iho/html/htmlstyle.scss
|
metadata
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: metanorma-iho
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.4.
|
|
4
|
+
version: 1.4.3
|
|
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
|
+
date: 2026-11-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: metanorma-generic
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 3.5.1
|
|
19
|
+
version: 3.5.1
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- - "
|
|
24
|
+
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 3.5.1
|
|
26
|
+
version: 3.5.1
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: debug
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -38,20 +38,6 @@ dependencies:
|
|
|
38
38
|
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '0'
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: equivalent-xml
|
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
|
44
|
-
requirements:
|
|
45
|
-
- - "~>"
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: '0.6'
|
|
48
|
-
type: :development
|
|
49
|
-
prerelease: false
|
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
-
requirements:
|
|
52
|
-
- - "~>"
|
|
53
|
-
- !ruby/object:Gem::Version
|
|
54
|
-
version: '0.6'
|
|
55
41
|
- !ruby/object:Gem::Dependency
|
|
56
42
|
name: guard
|
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -260,6 +246,7 @@ files:
|
|
|
260
246
|
- lib/metanorma/iho/iho-style.yml
|
|
261
247
|
- lib/metanorma/iho/iho.rng
|
|
262
248
|
- lib/metanorma/iho/log.rb
|
|
249
|
+
- lib/metanorma/iho/m3_stages.rb
|
|
263
250
|
- lib/metanorma/iho/mathml4-content.rng
|
|
264
251
|
- lib/metanorma/iho/mathml4-core.rng
|
|
265
252
|
- lib/metanorma/iho/mathml4-presentation.rng
|