metanorma-generic 3.2.3 → 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/html/htmlstyle.scss +10 -6
- 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 -75
- 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
|
|
@@ -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
|
}
|
|
@@ -328,11 +328,15 @@ p.Biblio, p.NormRef, div.Biblio, div.NormRef {
|
|
|
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
|
|
|
@@ -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"
|
|
@@ -75,50 +75,6 @@ module Metanorma
|
|
|
75
75
|
nil, false, "#{@filename}.pdf")
|
|
76
76
|
end
|
|
77
77
|
|
|
78
|
-
def schema_location
|
|
79
|
-
baselocation(configuration.validate_rng_file) ||
|
|
80
|
-
File.join(File.dirname(__FILE__), "generic.rng")
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
def schema_file
|
|
84
|
-
configuration.validate_rng_file || "generic.rng"
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def content_validate(doc)
|
|
88
|
-
super
|
|
89
|
-
bibdata_validate(doc.root)
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
def bibdata_validate(doc)
|
|
93
|
-
stage_validate(doc)
|
|
94
|
-
committee_validate(doc)
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
def stage_validate(xmldoc)
|
|
98
|
-
stages = configuration.stage_abbreviations&.keys || return
|
|
99
|
-
stages.empty? and return
|
|
100
|
-
stage = xmldoc.at("//bibdata/status/stage")&.text
|
|
101
|
-
stages.include? stage or
|
|
102
|
-
@log.add("GENERIC_2", nil, params: [stage])
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
def committee_validate(xmldoc)
|
|
106
|
-
committees = Array(configuration&.committees) || return
|
|
107
|
-
committees.empty? and return
|
|
108
|
-
xmldoc.xpath("//bibdata/contributor[role/description = 'committee']/" \
|
|
109
|
-
"organization/subdivision/name").each do |c|
|
|
110
|
-
committees.include? c.text or
|
|
111
|
-
@log.add("GENERIC_3", nil, params: [c.text])
|
|
112
|
-
end
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
def sections_cleanup(xml)
|
|
116
|
-
super
|
|
117
|
-
xml.xpath("//*[@inline-header]").each do |h|
|
|
118
|
-
h.delete("inline-header")
|
|
119
|
-
end
|
|
120
|
-
end
|
|
121
|
-
|
|
122
78
|
def blank_method(*args); end
|
|
123
79
|
|
|
124
80
|
def html_converter(node)
|
|
@@ -129,7 +85,7 @@ module Metanorma
|
|
|
129
85
|
IsoDoc::Generic::PresentationXMLConvert
|
|
130
86
|
.new(html_extract_attributes(node)
|
|
131
87
|
.merge(output_formats: ::Metanorma::Generic::Processor.new
|
|
132
|
-
|
|
88
|
+
.output_formats))
|
|
133
89
|
end
|
|
134
90
|
|
|
135
91
|
alias_method :pdf_converter, :html_converter
|
|
@@ -143,35 +99,6 @@ module Metanorma
|
|
|
143
99
|
def configuration
|
|
144
100
|
Metanorma::Generic.configuration
|
|
145
101
|
end
|
|
146
|
-
|
|
147
|
-
def boilerplate_isodoc(xmldoc)
|
|
148
|
-
conv = super or return nil
|
|
149
|
-
Metanorma::Generic::Configuration::CONFIG_ATTRS.each do |a|
|
|
150
|
-
conv.meta.set(a, configuration.send(a))
|
|
151
|
-
end
|
|
152
|
-
# conv.meta.set(:bibdata, bibdata_hash(xmldoc))
|
|
153
|
-
@isodoc = conv
|
|
154
|
-
@isodoc
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
def bibdata_hash(xmldoc)
|
|
158
|
-
b = xmldoc.at("//bibdata") || xmldoc.at("//xmlns:bibdata")
|
|
159
|
-
BibdataConfig.from_xml("<metanorma>#{b.to_xml}</metanorma>")
|
|
160
|
-
.bibdata.to_hash
|
|
161
|
-
end
|
|
162
|
-
|
|
163
|
-
def boilerplate_file(xmldoc)
|
|
164
|
-
f = configuration.boilerplate
|
|
165
|
-
f.nil? and return super
|
|
166
|
-
f.is_a? String and return baselocation(f)
|
|
167
|
-
f.is_a? Hash and f[@lang] and return baselocation(f[@lang])
|
|
168
|
-
super
|
|
169
|
-
end
|
|
170
|
-
|
|
171
|
-
def published?(status, _xmldoc)
|
|
172
|
-
stages = configuration&.published_stages || ["published"]
|
|
173
|
-
(Array(stages).map(&:downcase).include? status.downcase)
|
|
174
|
-
end
|
|
175
102
|
end
|
|
176
103
|
end
|
|
177
104
|
end
|
|
@@ -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.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: 2026-02
|
|
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.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.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
|