metanorma 2.5.6.pre.alpha.3 → 2.5.7
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 +1 -2
- data/Gemfile.devel +6 -0
- data/lib/metanorma/collection/config/config.rb +4 -2
- data/lib/metanorma/compile/compile.rb +10 -1
- data/lib/metanorma/compile/render.rb +21 -3
- data/lib/metanorma/version.rb +1 -1
- data/metanorma.gemspec +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d73fd0dd05e3f13aecfe06da74c57bdba985c633ca55464d90ad8eef1d54c3ea
|
|
4
|
+
data.tar.gz: 7b8c4a103f6ffce8d6a6234f18ef4f7e0cabf18af0c3aca9abec49e4e10255e8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8927439c5072688f6df2e001e9a97611d5d1802047e4f5b1572412c0217e8eead1255ff97fe464efc16c669887ae861de4d0364109b40202b36ff0151c8998e2
|
|
7
|
+
data.tar.gz: d45b9e9140271b2a4cfb6e9cef1a527ba13d69dceb07c9bd4181fd1b39f0180f319cb07858161e7e8683aeced2dd8c20a1b3a5ba222bec6b648a19dc01c06996
|
data/Gemfile
CHANGED
|
@@ -6,8 +6,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}" }
|
|
|
6
6
|
|
|
7
7
|
gemspec
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
gem "metanorma-core", github: "metanorma/metanorma-core", branch: "feat/flavor-table"
|
|
9
|
+
gem "metanorma-core", ">= 0.2.5"
|
|
11
10
|
|
|
12
11
|
begin
|
|
13
12
|
eval_gemfile("Gemfile.devel")
|
data/Gemfile.devel
CHANGED
|
@@ -18,3 +18,9 @@ gem "glossarist", "~> 2.13"
|
|
|
18
18
|
gem "lutaml-model", "~> 0.8.107"
|
|
19
19
|
gem "metanorma-plugin-glossarist", "~> 0.5"
|
|
20
20
|
gem "moxml", "~> 0.5"
|
|
21
|
+
# taste stack the compile specs exercise: the oiml taste registers the
|
|
22
|
+
# flavor and lazily requires metanorma-oiml (OIML STS transformers,
|
|
23
|
+
# unreleased); mko main carries the model-side export entry
|
|
24
|
+
gem "metanorma-taste", "~> 1.1"
|
|
25
|
+
gem "metanorma-oiml", github: "metanorma/metanorma-oiml", branch: "main"
|
|
26
|
+
gem "metanorma-mko", github: "metanorma/metanorma-mko", branch: "main"
|
|
@@ -26,8 +26,8 @@ module Metanorma
|
|
|
26
26
|
attribute :format, :string, collection: true, default: -> { [:html] }
|
|
27
27
|
attribute :output_folder, :string
|
|
28
28
|
attribute :compile, CompileOptions
|
|
29
|
-
attribute :prefatory_content, :string
|
|
30
|
-
attribute :final_content, :string
|
|
29
|
+
attribute :prefatory_content, :string
|
|
30
|
+
attribute :final_content, :string
|
|
31
31
|
attribute :documents, DocContainer, collection: true
|
|
32
32
|
attribute :xmlns, :string, default: -> { "http://metanorma.org" }
|
|
33
33
|
|
|
@@ -65,11 +65,13 @@ module Metanorma
|
|
|
65
65
|
map_element "compile", to: :compile, render_default: true
|
|
66
66
|
map_element "prefatory-content",
|
|
67
67
|
to: :prefatory_content,
|
|
68
|
+
raw: :content,
|
|
68
69
|
with: { from: :prefatory_from_xml,
|
|
69
70
|
to: :prefatory_to_xml }
|
|
70
71
|
map_element "doc-container", to: :documents
|
|
71
72
|
map_element "final-content",
|
|
72
73
|
to: :final_content,
|
|
74
|
+
raw: :content,
|
|
73
75
|
with: { from: :final_from_xml,
|
|
74
76
|
to: :final_to_xml }
|
|
75
77
|
end
|
|
@@ -56,6 +56,11 @@ module Metanorma
|
|
|
56
56
|
# Step 2: Prepare output paths
|
|
57
57
|
xml = Nokogiri::XML(semantic_xml, &:huge)
|
|
58
58
|
bibdata = extract_relaton_metadata(xml)
|
|
59
|
+
# bibdata is a Node of the full-document DOM: keeping it pins the
|
|
60
|
+
# whole DOM (gigabytes for large documents) for the entire output
|
|
61
|
+
# phase. Re-root the fragment into its own tiny document so the
|
|
62
|
+
# full DOM is collectable once this parse goes out of scope.
|
|
63
|
+
bibdata = reroot_bibdata(bibdata)
|
|
59
64
|
output_paths = prepare_output_paths(filename, bibdata, options)
|
|
60
65
|
|
|
61
66
|
# Step 3: Determine which output formats to generate
|
|
@@ -66,7 +71,11 @@ module Metanorma
|
|
|
66
71
|
# Step 4: Extract information from Semantic XML if requested
|
|
67
72
|
extract_information(semantic_xml, bibdata, options)
|
|
68
73
|
|
|
69
|
-
# Step 5: Generate output formats from Semantic XML
|
|
74
|
+
# Step 5: Generate output formats from Semantic XML. The output
|
|
75
|
+
# converters each build their own DOMs of the semantic XML;
|
|
76
|
+
# collect this phase's temporaries first so they stack on the
|
|
77
|
+
# live set, not on the converter phase's high-water mark.
|
|
78
|
+
GC.start
|
|
70
79
|
generate_outputs(
|
|
71
80
|
source_file, semantic_xml, bibdata, extensions, output_paths,
|
|
72
81
|
options
|
|
@@ -47,6 +47,19 @@ module Metanorma
|
|
|
47
47
|
xml.at("//bibdata") || xml.at("//xmlns:bibdata")
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
+
# Re-root a bibdata Node into a document of its own. The returned
|
|
51
|
+
# node answers the same metadata reads downstream (filename
|
|
52
|
+
# templates, relaton export), but no longer pins the full-document
|
|
53
|
+
# DOM it was parsed from — for large documents that DOM is the
|
|
54
|
+
# bulk of the compile's retained memory through the output phase.
|
|
55
|
+
def reroot_bibdata(bibdata)
|
|
56
|
+
return bibdata unless bibdata.is_a?(Nokogiri::XML::Node)
|
|
57
|
+
|
|
58
|
+
doc = Nokogiri::XML(bibdata.to_xml)
|
|
59
|
+
doc.at("//bibdata") || doc.at("//xmlns:bibdata") ||
|
|
60
|
+
doc.root || bibdata
|
|
61
|
+
end
|
|
62
|
+
|
|
50
63
|
def wrap_html(options, file_extension, outfilename)
|
|
51
64
|
if options[:wrapper] && /html$/.match(file_extension)
|
|
52
65
|
outfilename = outfilename.sub(/\.html$/, "")
|
|
@@ -124,12 +137,13 @@ module Metanorma
|
|
|
124
137
|
end
|
|
125
138
|
end
|
|
126
139
|
|
|
127
|
-
# Export the MKO machine serialization (metanorma-
|
|
140
|
+
# Export the MKO machine serialization (metanorma-mko). The
|
|
128
141
|
# semantic and presentation XML are already on disk by the time this
|
|
129
142
|
# runs; Mko resolves the flavor model via the Core::Flavors registry.
|
|
130
143
|
def export_mko_bundle(output_paths)
|
|
131
|
-
require "metanorma/document"
|
|
132
144
|
require "metanorma/mko"
|
|
145
|
+
# model side: the projection walk + export entry points
|
|
146
|
+
require "metanorma/mko/model"
|
|
133
147
|
# :xml is the freshly written semantic XML; orig_filename is the
|
|
134
148
|
# adoc SOURCE and is only right when an output_dir kept the
|
|
135
149
|
# semantic XML at the input location.
|
|
@@ -144,7 +158,7 @@ module Metanorma
|
|
|
144
158
|
rescue LoadError => e
|
|
145
159
|
@log.add_msg("MKO_OUTPUT" => { category: "MKO Output",
|
|
146
160
|
error: "the mko output format requires " \
|
|
147
|
-
"the metanorma-
|
|
161
|
+
"the metanorma-mko gem: %s",
|
|
148
162
|
severity: 0 })
|
|
149
163
|
@log.add("MKO_OUTPUT", nil, params: [e.message])
|
|
150
164
|
nil
|
|
@@ -164,6 +178,9 @@ module Metanorma
|
|
|
164
178
|
@processor.output(nil, output_paths[:presentationxml],
|
|
165
179
|
output_paths[:out], ext, isodoc_options)
|
|
166
180
|
wrap_html(options, output_paths[:ext], output_paths[:out])
|
|
181
|
+
# Each extension converter leaves a full DOM of the presentation XML
|
|
182
|
+
# behind; collect it before the next extension stacks its own.
|
|
183
|
+
GC.start
|
|
167
184
|
rescue StandardError => e
|
|
168
185
|
isodoc_error_process(e, strict_error?(ext, isodoc_options), false)
|
|
169
186
|
end
|
|
@@ -172,6 +189,7 @@ module Metanorma
|
|
|
172
189
|
def process_from_semantic_xml(ext, output_paths, sem_xml, isodoc_options)
|
|
173
190
|
@processor.output(sem_xml, output_paths[:xml], output_paths[:out],
|
|
174
191
|
ext, isodoc_options)
|
|
192
|
+
GC.start
|
|
175
193
|
true # Return as Thread equivalent
|
|
176
194
|
rescue StandardError => e
|
|
177
195
|
isodoc_error_process(e, strict_error?(ext, isodoc_options), true)
|
data/lib/metanorma/version.rb
CHANGED
data/metanorma.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: metanorma
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.5.
|
|
4
|
+
version: 2.5.7
|
|
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-10-
|
|
11
|
+
date: 2026-10-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: asciidoctor
|
|
@@ -196,16 +196,16 @@ dependencies:
|
|
|
196
196
|
name: relaton-cli
|
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
|
198
198
|
requirements:
|
|
199
|
-
- - "
|
|
199
|
+
- - "~>"
|
|
200
200
|
- !ruby/object:Gem::Version
|
|
201
|
-
version: 3.0
|
|
201
|
+
version: '3.0'
|
|
202
202
|
type: :runtime
|
|
203
203
|
prerelease: false
|
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
|
205
205
|
requirements:
|
|
206
|
-
- - "
|
|
206
|
+
- - "~>"
|
|
207
207
|
- !ruby/object:Gem::Version
|
|
208
|
-
version: 3.0
|
|
208
|
+
version: '3.0'
|
|
209
209
|
description: Library to process any Metanorma standard.
|
|
210
210
|
email:
|
|
211
211
|
- open.source@ribose.com
|