metanorma-standoc 3.5.22 → 3.5.24
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 +16 -1
- data/lib/metanorma/cleanup/maths.rb +1 -1
- data/lib/metanorma/converter/converter.rb +2 -0
- data/lib/metanorma/converter/log.rb +9 -0
- data/lib/metanorma/converter/section.rb +4 -0
- data/lib/metanorma/converter/update_unit.rb +58 -0
- data/lib/metanorma/standoc/document/sections/clause_section.rb +6 -0
- data/lib/metanorma/standoc/document/sections/standard_references_section.rb +8 -0
- data/lib/metanorma/standoc/version.rb +1 -1
- data/lib/metanorma/validate/standoc.rng +94 -0
- data/metanorma-standoc.gemspec +2 -1
- metadata +11 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 988539c4f9f6f2b1d7008f813ed311b3af749da9ece4e429e1977d3d0047ed4d
|
|
4
|
+
data.tar.gz: '0959cd387e865ee2775b635998cbe23ec2f0883299cefc23574a5aaf845783ac'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c929acac2799252d23add3b40e5ba68b1a94e031b86a01ba7966c90c3fe65299e681137a4b9bf22e37344764f6bc2e64ab856a656356e2af5461a560965714de
|
|
7
|
+
data.tar.gz: 7c8ff7e1ac4d9c9ea1382f37b58877040b66cb3632c3b68960384c77043368e214e349d5880f969e4247ca2028defa91eb581f15a5c018bfe034b95ef61a505a
|
data/Gemfile
CHANGED
|
@@ -13,7 +13,22 @@ gem "metanorma-mirror", "~> 1.0"
|
|
|
13
13
|
# https://github.com/metanorma/metanorma-plugin-lutaml/issues/292
|
|
14
14
|
gem "lutaml", "< 0.11"
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
# Stopgap: lutaml-lml 0.3.7 turned the gem into a stub alias forwarding
|
|
17
|
+
# require "lutaml/lml" into the lutaml gem — which only carries that file
|
|
18
|
+
# from 0.11.8, inside the cap above. Hold the alias down until the stub
|
|
19
|
+
# ships its lutaml >= 0.11.8 floor.
|
|
20
|
+
gem "lutaml-lml", "< 0.3.7"
|
|
21
|
+
|
|
22
|
+
# Stopgap: leptris 1.9.434.0+ breaks RelaxNG cross-include combine
|
|
23
|
+
# semantics — lib/metanorma/validate/standoc-compile.rng (two included
|
|
24
|
+
# grammars) then rejects even the root element of valid documents
|
|
25
|
+
# (spec/validate/schema_spec). Pin until the leptris regression ships a
|
|
26
|
+
# fix.
|
|
27
|
+
gem "leptris", "1.9.433.0"
|
|
28
|
+
|
|
29
|
+
# Pin: update units (metanorma-document#122); return to "~> 0.5" once it is released.
|
|
30
|
+
gem "metanorma-document", github: "metanorma/metanorma-document",
|
|
31
|
+
ref: "b2d7d50b4b1dbb85daa02387dcfb60a745960185"
|
|
17
32
|
gem "isodoc", "~> 3.7"
|
|
18
33
|
# relaton 3.0.0.pre.alpha.1 from rubygems called the removed pubid
|
|
19
34
|
# base_identifier; the fix (db9840bdf) shipped in the 3.0.0.pre.alpha.4
|
|
@@ -33,7 +33,7 @@ module Metanorma
|
|
|
33
33
|
if NUMERIC_REGEX.match?(expr)
|
|
34
34
|
@novalid or elem["validate"] = "false"
|
|
35
35
|
<<~MATH
|
|
36
|
-
<math xmlns='#{MATHML_NS}'
|
|
36
|
+
<math xmlns='#{MATHML_NS}' displaystyle='false'><mn>#{expr}</mn></math>
|
|
37
37
|
MATH
|
|
38
38
|
else
|
|
39
39
|
expr.strip.empty? and return
|
|
@@ -25,9 +25,11 @@ module Metanorma
|
|
|
25
25
|
preprocessor Metanorma::Standoc::ResolveIncludePreprocessor
|
|
26
26
|
preprocessor Metanorma::Plugin::Lutaml::LutamlDataPreprocessor
|
|
27
27
|
preprocessor Metanorma::Plugin::Lutaml::LutamlXsdPreprocessor
|
|
28
|
+
preprocessor Metanorma::Plugin::Lutaml::LutamlJsonschemaPreprocessor
|
|
28
29
|
preprocessor Metanorma::Plugin::Lutaml::LutamlPreprocessor
|
|
29
30
|
preprocessor Metanorma::Plugin::Lutaml::LutamlUmlDatamodelDescriptionPreprocessor
|
|
30
31
|
preprocessor Metanorma::Plugin::Lutaml::LutamlEaXmiPreprocessor
|
|
32
|
+
preprocessor Metanorma::Plugin::Lutaml::LutamlEaUmlPreprocessor
|
|
31
33
|
preprocessor Metanorma::Plugin::Lutaml::XmiPartialLoadPreprocessor
|
|
32
34
|
inline_macro Metanorma::Plugin::Lutaml::LutamlFigureInlineMacro
|
|
33
35
|
inline_macro Metanorma::Plugin::Lutaml::LutamlTableInlineMacro
|
|
@@ -218,6 +218,15 @@ module Metanorma
|
|
|
218
218
|
"but lies outside the include jail %s; compile " \
|
|
219
219
|
"with --base-dir <directory> to widen the jail",
|
|
220
220
|
severity: 0 },
|
|
221
|
+
STANDOC_70: { category: "Update Units",
|
|
222
|
+
error: "Update unit %s has no amendment records in %s",
|
|
223
|
+
severity: 1 },
|
|
224
|
+
STANDOC_71: { category: "Update Units",
|
|
225
|
+
error: "Update records file %s does not exist",
|
|
226
|
+
severity: 0 },
|
|
227
|
+
STANDOC_72: { category: "Update Units",
|
|
228
|
+
error: "Update records file %s is malformed: %s",
|
|
229
|
+
severity: 0 },
|
|
221
230
|
RELATON_1: { category: "Relaton",
|
|
222
231
|
error: "(Error from Relaton) %s",
|
|
223
232
|
severity: 0 },
|
|
@@ -2,10 +2,13 @@ require "uri" if /^2\./.match?(RUBY_VERSION)
|
|
|
2
2
|
require_relative "ref_sect"
|
|
3
3
|
require_relative "terms"
|
|
4
4
|
require_relative "sectiontype"
|
|
5
|
+
require_relative "update_unit"
|
|
5
6
|
|
|
6
7
|
module Metanorma
|
|
7
8
|
module Standoc
|
|
8
9
|
module Section
|
|
10
|
+
include UpdateUnit
|
|
11
|
+
|
|
9
12
|
@biblio = false
|
|
10
13
|
@term_def = false
|
|
11
14
|
@norm_ref = false
|
|
@@ -132,6 +135,7 @@ module Metanorma
|
|
|
132
135
|
return appendix_parse(attrs, xml, node)
|
|
133
136
|
xml.send :clause, **attr_code(attrs) do |xml_section|
|
|
134
137
|
section_title(xml_section, node.title)
|
|
138
|
+
clause_update_unit_parse(xml_section, node)
|
|
135
139
|
xml_section << node.content
|
|
136
140
|
end
|
|
137
141
|
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
module Metanorma
|
|
2
|
+
module Standoc
|
|
3
|
+
# AsciiDoc surface for update units (metanorma-document
|
|
4
|
+
# Components::UpdateUnits). A clause declares itself an update unit
|
|
5
|
+
# with `update-unit=<unit>`; its amendment records are structured
|
|
6
|
+
# data read from a YAML register (`update-records=<path>` on the
|
|
7
|
+
# clause, or the `:update-records:` document attribute), keyed by
|
|
8
|
+
# unit name or clause anchor. The records are emitted as the
|
|
9
|
+
# division's `<update-unit>`; Records of Updates are derived from
|
|
10
|
+
# them downstream, never authored as tables.
|
|
11
|
+
#
|
|
12
|
+
# The clause-parse hook is named `clause_update_unit_parse`, not
|
|
13
|
+
# `update_unit_parse`: every converter inherits this module, and
|
|
14
|
+
# released flavors already define same-named methods of their own
|
|
15
|
+
# (metanorma-iho 1.4.6 parses its update-unit section identifiers
|
|
16
|
+
# through `update_unit_parse(val)`); an unnamespaced hook name would
|
|
17
|
+
# shadow theirs and break every clause parse with an arity error.
|
|
18
|
+
module UpdateUnit
|
|
19
|
+
def clause_update_unit_parse(xml, node)
|
|
20
|
+
unit = node.attr("update-unit") or return
|
|
21
|
+
record = update_unit_record(node, unit)
|
|
22
|
+
record ||= ::Metanorma::Document::Components::UpdateUnits::UpdateUnit
|
|
23
|
+
.new(unit: unit)
|
|
24
|
+
record.unit = unit
|
|
25
|
+
xml << record.to_xml
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def update_unit_record(node, unit)
|
|
29
|
+
path = node.attr("update-records") ||
|
|
30
|
+
node.document.attr("update-records") or return nil
|
|
31
|
+
register = update_unit_register(path, node) or return nil
|
|
32
|
+
rec = register[unit] || register[node.id]
|
|
33
|
+
rec or @log.add("STANDOC_70", node, params: [unit, path])
|
|
34
|
+
rec
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def update_unit_register(path, node)
|
|
38
|
+
@update_unit_registers ||= {}
|
|
39
|
+
@update_unit_registers.fetch(path) do
|
|
40
|
+
@update_unit_registers[path] = update_unit_load(path, node)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def update_unit_load(path, node)
|
|
45
|
+
file = File.expand_path(path, @localdir || Dir.pwd)
|
|
46
|
+
unless File.exist?(file)
|
|
47
|
+
@log.add("STANDOC_71", node, params: [path])
|
|
48
|
+
return nil
|
|
49
|
+
end
|
|
50
|
+
::Metanorma::Document::UpdateUnits
|
|
51
|
+
.load_register(File.read(file, encoding: "utf-8"))
|
|
52
|
+
rescue ArgumentError, Psych::Exception, Lutaml::Model::Error => e
|
|
53
|
+
@log.add("STANDOC_72", node, params: [path, e.message])
|
|
54
|
+
nil
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -27,6 +27,11 @@ module Metanorma
|
|
|
27
27
|
attribute :title,
|
|
28
28
|
Metanorma::Document::Components::Inline::TitleWithAnnotationElement
|
|
29
29
|
|
|
30
|
+
# Update-unit declaration and amendment records (loose-leaf
|
|
31
|
+
# publications: the clause is amended on its own)
|
|
32
|
+
attribute :update_unit,
|
|
33
|
+
Metanorma::Document::Components::UpdateUnits::UpdateUnit
|
|
34
|
+
|
|
30
35
|
# Sub-clauses (recursive)
|
|
31
36
|
attribute :clause, ClauseSection, collection: true
|
|
32
37
|
|
|
@@ -84,6 +89,7 @@ module Metanorma
|
|
|
84
89
|
|
|
85
90
|
Metanorma::Standoc::Document::SectionXmlMapping.apply_clause_attributes(self)
|
|
86
91
|
Metanorma::Standoc::Document::SectionXmlMapping.apply_clause_elements(self)
|
|
92
|
+
map_element "update-unit", to: :update_unit
|
|
87
93
|
end
|
|
88
94
|
end
|
|
89
95
|
end
|
|
@@ -26,6 +26,13 @@ module Metanorma
|
|
|
26
26
|
collection: true
|
|
27
27
|
attribute :note,
|
|
28
28
|
Metanorma::Document::Components::Paragraphs::ParagraphBlock, collection: true
|
|
29
|
+
# Admonition children (e.g. an `[EDITOR]` editorial note placed
|
|
30
|
+
# after the reference list) are part of the section content:
|
|
31
|
+
# without the mapping they were dropped at model ingest and never
|
|
32
|
+
# reached the renderers (metanorma-iso#1764).
|
|
33
|
+
attribute :admonition,
|
|
34
|
+
Metanorma::Document::Components::MultiParagraph::AdmonitionBlock,
|
|
35
|
+
collection: true
|
|
29
36
|
attribute :p,
|
|
30
37
|
Metanorma::Document::Components::Paragraphs::ParagraphBlock, collection: true
|
|
31
38
|
attribute :table,
|
|
@@ -77,6 +84,7 @@ module Metanorma
|
|
|
77
84
|
map_element "title", to: :title
|
|
78
85
|
map_element "p", to: :p
|
|
79
86
|
map_element "note", to: :note
|
|
87
|
+
map_element "admonition", to: :admonition
|
|
80
88
|
map_element "bibitem", to: :references
|
|
81
89
|
map_element "passthrough", to: :passthrough
|
|
82
90
|
map_element "table", to: :table
|
|
@@ -1967,6 +1967,11 @@ are siblings to subclauses (hanging paragraphs)</a:documentation>
|
|
|
1967
1967
|
<a:documentation>Title of section</a:documentation>
|
|
1968
1968
|
</ref>
|
|
1969
1969
|
</optional>
|
|
1970
|
+
<optional>
|
|
1971
|
+
<ref name="update-unit">
|
|
1972
|
+
<a:documentation>Declares the clause an update unit, amended independently of the publication containing it</a:documentation>
|
|
1973
|
+
</ref>
|
|
1974
|
+
</optional>
|
|
1970
1975
|
<choice>
|
|
1971
1976
|
<choice>
|
|
1972
1977
|
<oneOrMore>
|
|
@@ -1990,6 +1995,95 @@ used in document amendments</a:documentation>
|
|
|
1990
1995
|
</oneOrMore>
|
|
1991
1996
|
</choice>
|
|
1992
1997
|
</define>
|
|
1998
|
+
<define name="update-unit">
|
|
1999
|
+
<a:documentation>Update unit of a loose-leaf publication: its unit name, bibliographic identifier,
|
|
2000
|
+
last-update date, validity period, and structured amendment records</a:documentation>
|
|
2001
|
+
<element name="update-unit">
|
|
2002
|
+
<attribute name="unit">
|
|
2003
|
+
<a:documentation>Unit name the amendment records are filed under, e.g. B-400</a:documentation>
|
|
2004
|
+
</attribute>
|
|
2005
|
+
<optional>
|
|
2006
|
+
<element name="identifier">
|
|
2007
|
+
<a:documentation>Bibliographic identifier of the unit, e.g. S-4 Part B, Section 400</a:documentation>
|
|
2008
|
+
<text/>
|
|
2009
|
+
</element>
|
|
2010
|
+
</optional>
|
|
2011
|
+
<optional>
|
|
2012
|
+
<element name="last-updated">
|
|
2013
|
+
<data type="date"/>
|
|
2014
|
+
</element>
|
|
2015
|
+
</optional>
|
|
2016
|
+
<optional>
|
|
2017
|
+
<element name="validity">
|
|
2018
|
+
<optional>
|
|
2019
|
+
<element name="begins">
|
|
2020
|
+
<data type="date"/>
|
|
2021
|
+
</element>
|
|
2022
|
+
</optional>
|
|
2023
|
+
<optional>
|
|
2024
|
+
<element name="ends">
|
|
2025
|
+
<data type="date"/>
|
|
2026
|
+
</element>
|
|
2027
|
+
</optional>
|
|
2028
|
+
</element>
|
|
2029
|
+
</optional>
|
|
2030
|
+
<zeroOrMore>
|
|
2031
|
+
<ref name="amendment-record"/>
|
|
2032
|
+
</zeroOrMore>
|
|
2033
|
+
</element>
|
|
2034
|
+
</define>
|
|
2035
|
+
<define name="amendment-record">
|
|
2036
|
+
<a:documentation>One amendment of an update unit</a:documentation>
|
|
2037
|
+
<element name="amendment-record">
|
|
2038
|
+
<optional>
|
|
2039
|
+
<attribute name="sequence">
|
|
2040
|
+
<a:documentation>Position of the amendment in the unit's amendment sequence</a:documentation>
|
|
2041
|
+
<data type="positiveInteger"/>
|
|
2042
|
+
</attribute>
|
|
2043
|
+
</optional>
|
|
2044
|
+
<optional>
|
|
2045
|
+
<element name="edition">
|
|
2046
|
+
<a:documentation>Publication edition the amendment was issued in</a:documentation>
|
|
2047
|
+
<text/>
|
|
2048
|
+
</element>
|
|
2049
|
+
</optional>
|
|
2050
|
+
<optional>
|
|
2051
|
+
<element name="date">
|
|
2052
|
+
<data type="date"/>
|
|
2053
|
+
</element>
|
|
2054
|
+
</optional>
|
|
2055
|
+
<optional>
|
|
2056
|
+
<element name="approval">
|
|
2057
|
+
<a:documentation>Approval that authorised the amendment</a:documentation>
|
|
2058
|
+
<text/>
|
|
2059
|
+
</element>
|
|
2060
|
+
</optional>
|
|
2061
|
+
<optional>
|
|
2062
|
+
<element name="reference">
|
|
2063
|
+
<a:documentation>Reference announcing the amendment, e.g. a circular letter</a:documentation>
|
|
2064
|
+
<text/>
|
|
2065
|
+
</element>
|
|
2066
|
+
</optional>
|
|
2067
|
+
<zeroOrMore>
|
|
2068
|
+
<element name="summary">
|
|
2069
|
+
<a:documentation>Summary of the amendment, one per language</a:documentation>
|
|
2070
|
+
<optional>
|
|
2071
|
+
<attribute name="language"/>
|
|
2072
|
+
</optional>
|
|
2073
|
+
<optional>
|
|
2074
|
+
<attribute name="script"/>
|
|
2075
|
+
</optional>
|
|
2076
|
+
<text/>
|
|
2077
|
+
</element>
|
|
2078
|
+
</zeroOrMore>
|
|
2079
|
+
<zeroOrMore>
|
|
2080
|
+
<element name="affected-unit">
|
|
2081
|
+
<a:documentation>Other update unit affected by the amendment</a:documentation>
|
|
2082
|
+
<text/>
|
|
2083
|
+
</element>
|
|
2084
|
+
</zeroOrMore>
|
|
2085
|
+
</element>
|
|
2086
|
+
</define>
|
|
1993
2087
|
<define name="Annex-Section">
|
|
1994
2088
|
<a:documentation>Clause constituting an annex or appendix</a:documentation>
|
|
1995
2089
|
<ref name="Annex-Section-Attributes"/>
|
data/metanorma-standoc.gemspec
CHANGED
|
@@ -37,7 +37,8 @@ Gem::Specification.new do |spec|
|
|
|
37
37
|
spec.add_dependency "metanorma-document", "~> 0.5.3"
|
|
38
38
|
spec.add_dependency "metanorma-mirror"
|
|
39
39
|
spec.add_dependency "metanorma-plugin-glossarist", "~> 0.5"
|
|
40
|
-
|
|
40
|
+
# LutamlJsonschemaPreprocessor shipped in 0.7.74
|
|
41
|
+
spec.add_dependency "metanorma-plugin-lutaml", "~> 0.7", ">= 0.7.74"
|
|
41
42
|
spec.add_dependency "metanorma-plugin-plantuml", "~> 1.0.0"
|
|
42
43
|
spec.add_dependency "metanorma-utils", "~> 2.0.12"
|
|
43
44
|
# moxml 0.6.0 removed the Opal surface (lutaml/moxml#516); owner
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: metanorma-standoc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.5.
|
|
4
|
+
version: 3.5.24
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|
|
@@ -128,14 +128,20 @@ dependencies:
|
|
|
128
128
|
requirements:
|
|
129
129
|
- - "~>"
|
|
130
130
|
- !ruby/object:Gem::Version
|
|
131
|
-
version: 0.7
|
|
131
|
+
version: '0.7'
|
|
132
|
+
- - ">="
|
|
133
|
+
- !ruby/object:Gem::Version
|
|
134
|
+
version: 0.7.74
|
|
132
135
|
type: :runtime
|
|
133
136
|
prerelease: false
|
|
134
137
|
version_requirements: !ruby/object:Gem::Requirement
|
|
135
138
|
requirements:
|
|
136
139
|
- - "~>"
|
|
137
140
|
- !ruby/object:Gem::Version
|
|
138
|
-
version: 0.7
|
|
141
|
+
version: '0.7'
|
|
142
|
+
- - ">="
|
|
143
|
+
- !ruby/object:Gem::Version
|
|
144
|
+
version: 0.7.74
|
|
139
145
|
- !ruby/object:Gem::Dependency
|
|
140
146
|
name: metanorma-plugin-plantuml
|
|
141
147
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -611,6 +617,7 @@ files:
|
|
|
611
617
|
- lib/metanorma/converter/sectiontype.rb
|
|
612
618
|
- lib/metanorma/converter/table.rb
|
|
613
619
|
- lib/metanorma/converter/terms.rb
|
|
620
|
+
- lib/metanorma/converter/update_unit.rb
|
|
614
621
|
- lib/metanorma/converter/utils.rb
|
|
615
622
|
- lib/metanorma/standoc.rb
|
|
616
623
|
- lib/metanorma/standoc/conform_profiles.rb
|