metanorma-generic 3.2.2 → 3.3.0
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/isodoc/generic/base_convert.rb +1 -1
- data/lib/isodoc/generic/html/generic.scss +4 -0
- data/lib/isodoc/generic/html/htmlstyle.scss +11 -7
- data/lib/isodoc/generic/metadata.rb +2 -2
- data/lib/isodoc/generic/pdf_convert.rb +0 -1
- data/lib/metanorma/generic/basicdoc.rng +5 -1
- data/lib/metanorma/generic/cleanup.rb +47 -0
- data/lib/metanorma/generic/converter.rb +2 -89
- data/lib/metanorma/generic/front.rb +18 -12
- data/lib/metanorma/generic/isodoc.rng +52 -16
- data/lib/metanorma/generic/validate.rb +46 -0
- data/lib/metanorma/generic/version.rb +1 -1
- data/lib/metanorma-generic.rb +2 -0
- data/metanorma-generic.gemspec +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 02f1cd5aac4e8c8d7fb67bfb1c3b2afd2e6bc62f96bc6b337f8b90232bccbad5
|
|
4
|
+
data.tar.gz: dbed9ba5a3184cc5892847ef330f2534b9802a1e1dc3479f4795f9467d70e016
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5c538904aa8c350cf8f92961db2fdab7ac9270444773b4a2ca7323cc55299a6fbc02ef21750c5373729a130ecb893dd63f1a7398c61d3cf016e2981972183d95
|
|
7
|
+
data.tar.gz: 0de729ab75eff484b7c599cc5259c6dc676504a4828a4542ebc0974bbf2578653b0a5de0e67ce7d192869d6bb7f04e8f71d13ea1778c9927a438d972f9fbc658
|
|
@@ -21,7 +21,7 @@ module IsoDoc
|
|
|
21
21
|
def make_body(xml, docxml)
|
|
22
22
|
body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72",
|
|
23
23
|
"xml:lang": "EN-US", class: "container" }
|
|
24
|
-
xml.body
|
|
24
|
+
xml.body(**body_attr) do |body|
|
|
25
25
|
make_body1(body, docxml)
|
|
26
26
|
make_body2(body, docxml)
|
|
27
27
|
make_body3(body, docxml)
|
|
@@ -668,6 +668,10 @@ table.MsoISOTable td, table.MsoISOTableBig td
|
|
|
668
668
|
{border:solid windowtext 1pt;
|
|
669
669
|
mso-border-alt:solid windowtext 1pt;
|
|
670
670
|
padding:0cm 2.85pt 0cm 2.85pt;}
|
|
671
|
+
table.MsoNormalTable th, table.MsoNormalTable td {
|
|
672
|
+
border: none;
|
|
673
|
+
mso-border-alt: none;
|
|
674
|
+
}
|
|
671
675
|
table.MsoISOTable p, table.MsoISOTableBig p
|
|
672
676
|
{font-size:10.0pt; }
|
|
673
677
|
table.MsoTableGrid
|
|
@@ -78,11 +78,11 @@ nav {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
figure {
|
|
82
82
|
@include figureBlock();
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
table
|
|
85
|
+
table figure {
|
|
86
86
|
padding: 0;
|
|
87
87
|
margin: 0;
|
|
88
88
|
}
|
|
@@ -323,16 +323,20 @@ ol ul > li:first-child {
|
|
|
323
323
|
3.5 Bibliograhy
|
|
324
324
|
*/
|
|
325
325
|
|
|
326
|
-
p.Biblio, p.NormRef {
|
|
326
|
+
p.Biblio, p.NormRef, div.Biblio, div.NormRef {
|
|
327
327
|
margin-top: 1em;
|
|
328
328
|
margin-left: 2em;
|
|
329
329
|
}
|
|
330
330
|
|
|
331
|
+
.Biblio.note, .Biblio.Note, .NormRef.note, .NormRef.Note {
|
|
332
|
+
margin-left: 3em;
|
|
333
|
+
}
|
|
334
|
+
|
|
331
335
|
/*
|
|
332
336
|
3.6 Source Code + figures
|
|
333
337
|
*/
|
|
334
338
|
|
|
335
|
-
|
|
339
|
+
figure, pre, .pseudocode {
|
|
336
340
|
@include pseudocodeBlock(#f7f7f7);
|
|
337
341
|
}
|
|
338
342
|
|
|
@@ -344,7 +348,7 @@ pre {
|
|
|
344
348
|
@include recommendationBlock();
|
|
345
349
|
@include listBlock();
|
|
346
350
|
|
|
347
|
-
|
|
351
|
+
figcaption, .SourceTitle {
|
|
348
352
|
@include blockTitle()
|
|
349
353
|
}
|
|
350
354
|
|
|
@@ -399,7 +403,7 @@ table {
|
|
|
399
403
|
@include table(1px solid black);
|
|
400
404
|
}
|
|
401
405
|
|
|
402
|
-
|
|
406
|
+
table > caption {
|
|
403
407
|
text-align: center;
|
|
404
408
|
margin-top: 2.5em;
|
|
405
409
|
font-weight: 400;
|
|
@@ -658,7 +662,7 @@ To top button
|
|
|
658
662
|
margin-top: 1.2em;
|
|
659
663
|
}
|
|
660
664
|
|
|
661
|
-
.note,
|
|
665
|
+
.note, figure, pre, .pseudocode, table {
|
|
662
666
|
page-break-inside: avoid;
|
|
663
667
|
}
|
|
664
668
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
require "isodoc"
|
|
2
2
|
require "nokogiri"
|
|
3
|
-
require_relative "init"
|
|
4
3
|
require_relative "utils"
|
|
5
4
|
|
|
6
5
|
class Nokogiri::XML::Node
|
|
@@ -41,7 +40,8 @@ module IsoDoc
|
|
|
41
40
|
|
|
42
41
|
def images(isoxml, out)
|
|
43
42
|
default_logo_path =
|
|
44
|
-
File.expand_path(File.join(File.dirname(__FILE__), "html",
|
|
43
|
+
File.expand_path(File.join(File.dirname(__FILE__), "html",
|
|
44
|
+
"logo.jpg"))
|
|
45
45
|
set(:logo, baselocation(configuration.logo_path) || default_logo_path)
|
|
46
46
|
unless configuration.logo_paths.nil?
|
|
47
47
|
set(:logo_paths,
|
|
@@ -208,11 +208,15 @@ Applicable to modify and delete</a:documentation>
|
|
|
208
208
|
</zeroOrMore>
|
|
209
209
|
<optional>
|
|
210
210
|
<element name="newcontent">
|
|
211
|
-
<a:documentation>New content to be added to the document; applicable to add and modify
|
|
211
|
+
<a:documentation>New content to be added to the document; applicable to add and modify.
|
|
212
|
+
Can be blocks and/or sections</a:documentation>
|
|
212
213
|
<ref name="OptionalId"/>
|
|
213
214
|
<zeroOrMore>
|
|
214
215
|
<ref name="BasicBlock"/>
|
|
215
216
|
</zeroOrMore>
|
|
217
|
+
<zeroOrMore>
|
|
218
|
+
<ref name="section"/>
|
|
219
|
+
</zeroOrMore>
|
|
216
220
|
</element>
|
|
217
221
|
</optional>
|
|
218
222
|
<zeroOrMore>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
module Metanorma
|
|
2
|
+
module Generic
|
|
3
|
+
class Cleanup < Standoc::Cleanup
|
|
4
|
+
extend Forwardable
|
|
5
|
+
|
|
6
|
+
def sections_cleanup(xml)
|
|
7
|
+
super
|
|
8
|
+
xml.xpath("//*[@inline-header]").each do |h|
|
|
9
|
+
h.delete("inline-header")
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def boilerplate_isodoc(xmldoc)
|
|
14
|
+
conv = super or return nil
|
|
15
|
+
Metanorma::Generic::Configuration::CONFIG_ATTRS.each do |a|
|
|
16
|
+
conv.meta.set(a, configuration.send(a))
|
|
17
|
+
end
|
|
18
|
+
# conv.meta.set(:bibdata, bibdata_hash(xmldoc))
|
|
19
|
+
@isodoc = conv
|
|
20
|
+
@isodoc
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def bibdata_hash(xmldoc)
|
|
24
|
+
b = xmldoc.at("//bibdata") || xmldoc.at("//xmlns:bibdata")
|
|
25
|
+
BibdataConfig.from_xml("<metanorma>#{b.to_xml}</metanorma>")
|
|
26
|
+
.bibdata.to_hash
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def boilerplate_file(xmldoc)
|
|
30
|
+
f = configuration.boilerplate
|
|
31
|
+
f.nil? and return super
|
|
32
|
+
f.is_a? String and return @conv.baselocation(f)
|
|
33
|
+
f.is_a? Hash and f[@lang] and return @conv.baselocation(f[@lang])
|
|
34
|
+
super
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def published?(status, _xmldoc)
|
|
38
|
+
stages = configuration&.published_stages || ["published"]
|
|
39
|
+
(Array(stages).map(&:downcase).include? status.downcase)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def configuration
|
|
43
|
+
@conv.configuration
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require "asciidoctor"
|
|
2
|
-
require "metanorma
|
|
2
|
+
require "metanorma-standoc"
|
|
3
3
|
require "fileutils"
|
|
4
4
|
require_relative "front"
|
|
5
5
|
require_relative "bibdata_config"
|
|
@@ -16,20 +16,6 @@ module Metanorma
|
|
|
16
16
|
loc
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
def docidentifier_cleanup(xmldoc)
|
|
20
|
-
docid = xmldoc.at("//bibdata/docidentifier") or return
|
|
21
|
-
docid.text.empty? or return
|
|
22
|
-
id = docidentifier_from_template(xmldoc) or return
|
|
23
|
-
(id.empty? and docid.remove) or docid.children = id
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def docidentifier_from_template(xmldoc)
|
|
27
|
-
b = boilerplate_isodoc(xmldoc) or return
|
|
28
|
-
template = configuration.docid_template ||
|
|
29
|
-
"{{ agency }} {{ docnumeric }}"
|
|
30
|
-
b.populate_template(template, nil)
|
|
31
|
-
end
|
|
32
|
-
|
|
33
19
|
def doctype(node)
|
|
34
20
|
d = super
|
|
35
21
|
node.attr("doctype") == "article" and d = "article"
|
|
@@ -89,50 +75,6 @@ module Metanorma
|
|
|
89
75
|
nil, false, "#{@filename}.pdf")
|
|
90
76
|
end
|
|
91
77
|
|
|
92
|
-
def schema_location
|
|
93
|
-
baselocation(configuration.validate_rng_file) ||
|
|
94
|
-
File.join(File.dirname(__FILE__), "generic.rng")
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
def schema_file
|
|
98
|
-
configuration.validate_rng_file || "generic.rng"
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
def content_validate(doc)
|
|
102
|
-
super
|
|
103
|
-
bibdata_validate(doc.root)
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
def bibdata_validate(doc)
|
|
107
|
-
stage_validate(doc)
|
|
108
|
-
committee_validate(doc)
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
def stage_validate(xmldoc)
|
|
112
|
-
stages = configuration.stage_abbreviations&.keys || return
|
|
113
|
-
stages.empty? and return
|
|
114
|
-
stage = xmldoc.at("//bibdata/status/stage")&.text
|
|
115
|
-
stages.include? stage or
|
|
116
|
-
@log.add("GENERIC_2", nil, params: [stage])
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
def committee_validate(xmldoc)
|
|
120
|
-
committees = Array(configuration&.committees) || return
|
|
121
|
-
committees.empty? and return
|
|
122
|
-
xmldoc.xpath("//bibdata/contributor[role/description = 'committee']/" \
|
|
123
|
-
"organization/subdivision/name").each do |c|
|
|
124
|
-
committees.include? c.text or
|
|
125
|
-
@log.add("GENERIC_3", nil, params: [c.text])
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
def sections_cleanup(xml)
|
|
130
|
-
super
|
|
131
|
-
xml.xpath("//*[@inline-header]").each do |h|
|
|
132
|
-
h.delete("inline-header")
|
|
133
|
-
end
|
|
134
|
-
end
|
|
135
|
-
|
|
136
78
|
def blank_method(*args); end
|
|
137
79
|
|
|
138
80
|
def html_converter(node)
|
|
@@ -143,7 +85,7 @@ module Metanorma
|
|
|
143
85
|
IsoDoc::Generic::PresentationXMLConvert
|
|
144
86
|
.new(html_extract_attributes(node)
|
|
145
87
|
.merge(output_formats: ::Metanorma::Generic::Processor.new
|
|
146
|
-
|
|
88
|
+
.output_formats))
|
|
147
89
|
end
|
|
148
90
|
|
|
149
91
|
alias_method :pdf_converter, :html_converter
|
|
@@ -157,35 +99,6 @@ module Metanorma
|
|
|
157
99
|
def configuration
|
|
158
100
|
Metanorma::Generic.configuration
|
|
159
101
|
end
|
|
160
|
-
|
|
161
|
-
def boilerplate_isodoc(xmldoc)
|
|
162
|
-
conv = super or return nil
|
|
163
|
-
Metanorma::Generic::Configuration::CONFIG_ATTRS.each do |a|
|
|
164
|
-
conv.meta.set(a, configuration.send(a))
|
|
165
|
-
end
|
|
166
|
-
# conv.meta.set(:bibdata, bibdata_hash(xmldoc))
|
|
167
|
-
@isodoc = conv
|
|
168
|
-
@isodoc
|
|
169
|
-
end
|
|
170
|
-
|
|
171
|
-
def bibdata_hash(xmldoc)
|
|
172
|
-
b = xmldoc.at("//bibdata") || xmldoc.at("//xmlns:bibdata")
|
|
173
|
-
BibdataConfig.from_xml("<metanorma>#{b.to_xml}</metanorma>")
|
|
174
|
-
.bibdata.to_hash
|
|
175
|
-
end
|
|
176
|
-
|
|
177
|
-
def boilerplate_file(xmldoc)
|
|
178
|
-
f = configuration.boilerplate
|
|
179
|
-
f.nil? and return super
|
|
180
|
-
f.is_a? String and return baselocation(f)
|
|
181
|
-
f.is_a? Hash and f[@lang] and return baselocation(f[@lang])
|
|
182
|
-
super
|
|
183
|
-
end
|
|
184
|
-
|
|
185
|
-
def published?(status, _xmldoc)
|
|
186
|
-
stages = configuration&.published_stages || ["published"]
|
|
187
|
-
(Array(stages).map(&:downcase).include? status.downcase)
|
|
188
|
-
end
|
|
189
102
|
end
|
|
190
103
|
end
|
|
191
104
|
end
|
|
@@ -27,25 +27,31 @@ module Metanorma
|
|
|
27
27
|
|
|
28
28
|
def metadata_status(node, xml)
|
|
29
29
|
xml.status do |s|
|
|
30
|
-
add_noko_elem(s, "stage", node.attr("status") ||
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
add_noko_elem(s, "stage", node.attr("status") ||
|
|
31
|
+
node.attr("docstage") ||
|
|
32
|
+
configuration.default_stage || "published",
|
|
33
|
+
abbreviation: node.attr("docstage-abbrev"))
|
|
34
34
|
add_noko_elem(s, "substage", node.attr("substage"))
|
|
35
|
-
# x = node.attr("substage") and s.substage x
|
|
36
35
|
add_noko_elem(s, "iteration", node.attr("iteration"))
|
|
37
|
-
# x = node.attr("iteration") and s.iteration x
|
|
38
36
|
end
|
|
39
37
|
end
|
|
40
38
|
|
|
41
39
|
def metadata_id(node, xml)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
if id = node.attr("docidentifier") || configuration.docid_template ||
|
|
41
|
+
"{{ agency }} {{ docnumeric }}"
|
|
42
|
+
add_noko_elem(xml, "docidentifier",
|
|
43
|
+
id, primary: "true", boilerplate: true,
|
|
44
|
+
type: metadata_id_primary_type(node))
|
|
45
|
+
else
|
|
46
|
+
metadata_id_primary(node, xml)
|
|
46
47
|
end
|
|
47
48
|
end
|
|
48
49
|
|
|
50
|
+
def metadata_id_primary_type(node)
|
|
51
|
+
node.attr("publisher_abbr") || node.attr("publisher") ||
|
|
52
|
+
configuration.organization_name_short
|
|
53
|
+
end
|
|
54
|
+
|
|
49
55
|
def metadata_ext(node, ext)
|
|
50
56
|
super
|
|
51
57
|
if configuration.metadata_extensions.is_a? Hash
|
|
@@ -75,8 +81,8 @@ module Metanorma
|
|
|
75
81
|
def metadata_doctype(node, xml)
|
|
76
82
|
d = doctype(node)
|
|
77
83
|
add_noko_elem(xml, "doctype", d,
|
|
78
|
-
abbreviation:
|
|
79
|
-
|
|
84
|
+
abbreviation: node.attr("doctype-abbrev") ||
|
|
85
|
+
configuration&.doctypes&.dig(d))
|
|
80
86
|
end
|
|
81
87
|
|
|
82
88
|
EXT_STRUCT = %w(_output _attribute _list).freeze
|
|
@@ -167,12 +167,6 @@ Sources are currently only rendered in metanorma-plateau</a:documentation>
|
|
|
167
167
|
</define>
|
|
168
168
|
<define name="DlAttributes">
|
|
169
169
|
<ref name="BlockAttributes"/>
|
|
170
|
-
<optional>
|
|
171
|
-
<attribute name="key">
|
|
172
|
-
<a:documentation>This definition list is the key of a figure or formula</a:documentation>
|
|
173
|
-
<data type="boolean"/>
|
|
174
|
-
</attribute>
|
|
175
|
-
</optional>
|
|
176
170
|
</define>
|
|
177
171
|
<define name="DlBody">
|
|
178
172
|
<optional>
|
|
@@ -311,7 +305,7 @@ and is intended to be referenced by a callout within the source code</a:document
|
|
|
311
305
|
</ref>
|
|
312
306
|
</optional>
|
|
313
307
|
<choice>
|
|
314
|
-
<a:documentation>Content of the figure
|
|
308
|
+
<a:documentation>Content of the figure</a:documentation>
|
|
315
309
|
<ref name="image">
|
|
316
310
|
<a:documentation>by default the content of a figure is a media file</a:documentation>
|
|
317
311
|
</ref>
|
|
@@ -340,8 +334,8 @@ and is intended to be referenced by a callout within the source code</a:document
|
|
|
340
334
|
</ref>
|
|
341
335
|
</zeroOrMore>
|
|
342
336
|
<optional>
|
|
343
|
-
<ref name="
|
|
344
|
-
<a:documentation>An
|
|
337
|
+
<ref name="key">
|
|
338
|
+
<a:documentation>An key defining any symbols used in the figure</a:documentation>
|
|
345
339
|
</ref>
|
|
346
340
|
</optional>
|
|
347
341
|
<zeroOrMore>
|
|
@@ -365,7 +359,7 @@ and is intended to be referenced by a callout within the source code</a:document
|
|
|
365
359
|
</ref>
|
|
366
360
|
</optional>
|
|
367
361
|
<choice>
|
|
368
|
-
<a:documentation>Content of the figure
|
|
362
|
+
<a:documentation>Content of the figure</a:documentation>
|
|
369
363
|
<ref name="image-no-id">
|
|
370
364
|
<a:documentation>by default the content of a figure is a media file</a:documentation>
|
|
371
365
|
</ref>
|
|
@@ -429,7 +423,7 @@ in order to be applicable in this standardisation document</a:documentation>
|
|
|
429
423
|
</element>
|
|
430
424
|
</define>
|
|
431
425
|
<define name="sourcecodebody">
|
|
432
|
-
<a:documentation>The computer code or other such text presented in the block, as a single unformatted string.
|
|
426
|
+
<a:documentation>The computer code or other such text presented in the block, as a single unformatted string.
|
|
433
427
|
(The string should be treated as pre-formatted text, with whitespace treated as significant)</a:documentation>
|
|
434
428
|
<element name="body">
|
|
435
429
|
<oneOrMore>
|
|
@@ -549,7 +543,7 @@ normative or informative references, some split references into sections organiz
|
|
|
549
543
|
<choice>
|
|
550
544
|
<a:documentation>Table cell contains a block</a:documentation>
|
|
551
545
|
<ref name="paragraph-with-footnote"/>
|
|
552
|
-
<ref name="
|
|
546
|
+
<ref name="key"/>
|
|
553
547
|
<ref name="ul"/>
|
|
554
548
|
<ref name="ol"/>
|
|
555
549
|
<ref name="figure"/>
|
|
@@ -632,8 +626,40 @@ This is done if the footnote reference is already presented in some other form,
|
|
|
632
626
|
<a:documentation>The number of the footnote, used to identify it visually</a:documentation>
|
|
633
627
|
</attribute>
|
|
634
628
|
</define>
|
|
629
|
+
<define name="FormulaBody">
|
|
630
|
+
<ref name="stem">
|
|
631
|
+
<a:documentation>The content of the formula, as a mathematical expression</a:documentation>
|
|
632
|
+
</ref>
|
|
633
|
+
<optional>
|
|
634
|
+
<ref name="key">
|
|
635
|
+
<a:documentation>A key defining any symbols used in the formula</a:documentation>
|
|
636
|
+
</ref>
|
|
637
|
+
</optional>
|
|
638
|
+
<zeroOrMore>
|
|
639
|
+
<ref name="note">
|
|
640
|
+
<a:documentation>Notes whose scope is the current block</a:documentation>
|
|
641
|
+
</ref>
|
|
642
|
+
</zeroOrMore>
|
|
643
|
+
</define>
|
|
635
644
|
</include>
|
|
636
645
|
<!-- end overrides -->
|
|
646
|
+
<define name="key">
|
|
647
|
+
<a:documentation>Key to a table, figure, or formula</a:documentation>
|
|
648
|
+
<element name="key">
|
|
649
|
+
<optional>
|
|
650
|
+
<ref name="tname">
|
|
651
|
+
<a:documentation>optional title of key</a:documentation>
|
|
652
|
+
</ref>
|
|
653
|
+
</optional>
|
|
654
|
+
<oneOrMore>
|
|
655
|
+
<choice>
|
|
656
|
+
<a:documentation>Definition list and/or paragraph content</a:documentation>
|
|
657
|
+
<ref name="dl"/>
|
|
658
|
+
<ref name="paragraph"/>
|
|
659
|
+
</choice>
|
|
660
|
+
</oneOrMore>
|
|
661
|
+
</element>
|
|
662
|
+
</define>
|
|
637
663
|
<define name="TdAttributes" combine="interleave">
|
|
638
664
|
<ref name="RequiredId"/>
|
|
639
665
|
<optional>
|
|
@@ -1042,7 +1068,7 @@ parargaph sources are currently only rendered in metanorma-plateau</a:documentat
|
|
|
1042
1068
|
</optional>
|
|
1043
1069
|
<optional>
|
|
1044
1070
|
<attribute name="custom-charset">
|
|
1045
|
-
<a:documentation>Character set that the contained text belongs to;
|
|
1071
|
+
<a:documentation>Character set that the contained text belongs to;
|
|
1046
1072
|
is used in particular to capture mutually agreed definitions of codepoints in Unicode Private Use Area</a:documentation>
|
|
1047
1073
|
</attribute>
|
|
1048
1074
|
</optional>
|
|
@@ -1623,7 +1649,7 @@ numbers</a:documentation>
|
|
|
1623
1649
|
<define name="definitions">
|
|
1624
1650
|
<a:documentation>One or more definition lists, used to define symbols and abbreviations used in the remainder of the document.
|
|
1625
1651
|
These can also be used as glossaries, with simple definitions, in contrast to the more elaborate definitions given in
|
|
1626
|
-
terms sections
|
|
1652
|
+
terms sections</a:documentation>
|
|
1627
1653
|
<element name="definitions">
|
|
1628
1654
|
<ref name="OptionalId"/>
|
|
1629
1655
|
<ref name="LocalizedStringAttributes"/>
|
|
@@ -1864,7 +1890,7 @@ used in document amendments</a:documentation>
|
|
|
1864
1890
|
</zeroOrMore>
|
|
1865
1891
|
<zeroOrMore>
|
|
1866
1892
|
<ref name="related">
|
|
1867
|
-
<a:documentation>Zero or more names which are related to the term being defined
|
|
1893
|
+
<a:documentation>Zero or more names which are related to the term being defined.</a:documentation>
|
|
1868
1894
|
</ref>
|
|
1869
1895
|
</zeroOrMore>
|
|
1870
1896
|
<optional>
|
|
@@ -2025,7 +2051,7 @@ used in document amendments</a:documentation>
|
|
|
2025
2051
|
<element name="letter-symbol">
|
|
2026
2052
|
<optional>
|
|
2027
2053
|
<attribute name="isInternational">
|
|
2028
|
-
<a:documentation>Whether the designation is the same across languages, or language-specific
|
|
2054
|
+
<a:documentation>Whether the designation is the same across languages, or language-specific</a:documentation>
|
|
2029
2055
|
<data type="boolean"/>
|
|
2030
2056
|
</attribute>
|
|
2031
2057
|
</optional>
|
|
@@ -2632,6 +2658,11 @@ links within an SVG file, so that the SVG file can hyperlink to anchors within t
|
|
|
2632
2658
|
<a:documentation>Connective linking this location to its predecessor. _from/to_ are presumed to nest more closely than _and_ or _or_</a:documentation>
|
|
2633
2659
|
<ref name="XrefConnectiveType"/>
|
|
2634
2660
|
</attribute>
|
|
2661
|
+
<optional>
|
|
2662
|
+
<attribute name="custom-connective">
|
|
2663
|
+
<a:documentation>Custom wording for connnective linking this location to its predecessor, custom wording. If provided, is treated as equivalent semantically to connective value</a:documentation>
|
|
2664
|
+
</attribute>
|
|
2665
|
+
</optional>
|
|
2635
2666
|
</element>
|
|
2636
2667
|
</define>
|
|
2637
2668
|
<define name="XrefStyleType">
|
|
@@ -2658,6 +2689,11 @@ links within an SVG file, so that the SVG file can hyperlink to anchors within t
|
|
|
2658
2689
|
<ref name="XrefConnectiveType"/>
|
|
2659
2690
|
</attribute>
|
|
2660
2691
|
</optional>
|
|
2692
|
+
<optional>
|
|
2693
|
+
<attribute name="custom-connective">
|
|
2694
|
+
<a:documentation>Custom wording for connnective linking this location to its predecessor, custom wording. If provided, is treated as equivalent semantically to connective value</a:documentation>
|
|
2695
|
+
</attribute>
|
|
2696
|
+
</optional>
|
|
2661
2697
|
<ref name="erefType"/>
|
|
2662
2698
|
</define>
|
|
2663
2699
|
<define name="erefstack">
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
module Metanorma
|
|
2
|
+
module Generic
|
|
3
|
+
class Validate < Standoc::Validate
|
|
4
|
+
def schema_location
|
|
5
|
+
@conv.baselocation(configuration.validate_rng_file) ||
|
|
6
|
+
File.join(File.dirname(__FILE__), "generic.rng")
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def schema_file
|
|
10
|
+
configuration.validate_rng_file || "generic.rng"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def content_validate(doc)
|
|
14
|
+
super
|
|
15
|
+
bibdata_validate(doc.root)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def bibdata_validate(doc)
|
|
19
|
+
stage_validate(doc)
|
|
20
|
+
committee_validate(doc)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def stage_validate(xmldoc)
|
|
24
|
+
stages = configuration.stage_abbreviations&.keys || return
|
|
25
|
+
stages.empty? and return
|
|
26
|
+
stage = xmldoc.at("//bibdata/status/stage")&.text
|
|
27
|
+
stages.include? stage or
|
|
28
|
+
@log.add("GENERIC_2", nil, params: [stage])
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def committee_validate(xmldoc)
|
|
32
|
+
committees = Array(configuration&.committees) || return
|
|
33
|
+
committees.empty? and return
|
|
34
|
+
xmldoc.xpath("//bibdata/contributor[role/description = 'committee']/" \
|
|
35
|
+
"organization/subdivision/name").each do |c|
|
|
36
|
+
committees.include? c.text or
|
|
37
|
+
@log.add("GENERIC_3", nil, params: [c.text])
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def configuration
|
|
42
|
+
@conv.configuration
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
data/lib/metanorma-generic.rb
CHANGED
data/metanorma-generic.gemspec
CHANGED
|
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
|
27
27
|
spec.require_paths = ["lib"]
|
|
28
28
|
spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
|
|
29
29
|
|
|
30
|
-
spec.add_dependency "metanorma-standoc", "~> 3.
|
|
30
|
+
spec.add_dependency "metanorma-standoc", "~> 3.3.1"
|
|
31
31
|
|
|
32
32
|
spec.add_development_dependency "debug"
|
|
33
33
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: metanorma-generic
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-03-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: metanorma-standoc
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 3.
|
|
19
|
+
version: 3.3.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.
|
|
26
|
+
version: 3.3.1
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: debug
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -240,6 +240,7 @@ files:
|
|
|
240
240
|
- lib/metanorma/generic/bibdata_config.rb
|
|
241
241
|
- lib/metanorma/generic/biblio-standoc.rng
|
|
242
242
|
- lib/metanorma/generic/biblio.rng
|
|
243
|
+
- lib/metanorma/generic/cleanup.rb
|
|
243
244
|
- lib/metanorma/generic/converter.rb
|
|
244
245
|
- lib/metanorma/generic/fonts_manifest.yaml
|
|
245
246
|
- lib/metanorma/generic/front.rb
|
|
@@ -249,6 +250,7 @@ files:
|
|
|
249
250
|
- lib/metanorma/generic/processor.rb
|
|
250
251
|
- lib/metanorma/generic/reqt.rng
|
|
251
252
|
- lib/metanorma/generic/rsd.rng
|
|
253
|
+
- lib/metanorma/generic/validate.rb
|
|
252
254
|
- lib/metanorma/generic/version.rb
|
|
253
255
|
- metanorma-generic.gemspec
|
|
254
256
|
- metanorma.yml.example
|