metanorma 2.5.2 → 2.5.4
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/.rubocop.yml +9 -0
- data/lib/metanorma/collection/renderer/renderer.rb +21 -2
- data/lib/metanorma/compile/compile_options.rb +36 -3
- data/lib/metanorma/compile/render.rb +2 -2
- data/lib/metanorma/version.rb +1 -1
- metadata +7 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4f36a841296240362316b293a3353c54b85b83485b81d21e762d639fe26ce100
|
|
4
|
+
data.tar.gz: 7302ecaa3bbf5893fa6a0c52199ce7080475efb00a9973fe8e21ace651a996b8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b9d143219d4f9a9130321c675e3b1bc8f5966dcb09961f13527381d493e7d6a6e7efffce28bd807bf5a07b2ae040048a321f498a8d15ecab002a756d8c493f8a
|
|
7
|
+
data.tar.gz: fd1c20bd7b7d1062130781c1276b95b921a9408d4da2a17d622f5b21053b8a20ab168daa710bfbdefbc652901bea7d5e7c75e891e7a1fb91d2dd74075edbe39b
|
data/.rubocop.yml
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
# See https://github.com/metanorma/cimas
|
|
3
3
|
inherit_from:
|
|
4
4
|
- https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
|
|
5
|
+
# .rubocop_todo.yml MUST be the last entry. inherit_from is last-wins:
|
|
6
|
+
# if listed before oss-guides, the shared config's stricter Metrics/
|
|
7
|
+
# (MethodLength, BlockLength, etc.) rules override the todo's per-file
|
|
8
|
+
# grandfathering, and the todo becomes inert on those cops. Empirically
|
|
9
|
+
# verified on suma 2026-07-06: with todo listed first, 34 Metrics/* offenses
|
|
10
|
+
# remained; moved last, cleared. Every gem in the metanorma-org fleet
|
|
11
|
+
# already ships a `.rubocop_todo.yml` on its live tree (audited 2026-07-06,
|
|
12
|
+
# 54/54 have it), so this reference is safe to emit unconditionally.
|
|
13
|
+
- .rubocop_todo.yml
|
|
5
14
|
|
|
6
15
|
# Rubocop plugins enabled centrally so every metanorma-org gem picks them up
|
|
7
16
|
# on cimas sync — best practice belongs at the shared-template layer, not
|
|
@@ -161,13 +161,32 @@ module Metanorma
|
|
|
161
161
|
abs = Pathname.new(val).absolute?
|
|
162
162
|
directives.reject! { |d| d.key == name }
|
|
163
163
|
val = Util::rel_path_resolve(@dirname, val)
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
val =
|
|
165
|
+
if abs then directives_host_materialise(val)
|
|
166
|
+
else Pathname.new(val).relative_path_from(Pathname.new(@outdir)).to_s
|
|
167
|
+
end
|
|
166
168
|
directives << ::Metanorma::Collection::Config::Directive
|
|
167
169
|
.new(key: name, value: val)
|
|
168
170
|
directives
|
|
169
171
|
end
|
|
170
172
|
|
|
173
|
+
# An absolute directive value can point inside a gem payload (e.g. a
|
|
174
|
+
# taste's data/ file from Util.taste2coverpage_pdf_portfolio). A
|
|
175
|
+
# spawned child process that is not this Ruby (mn2pdf/java) may be
|
|
176
|
+
# unable to read such a path (a packaged virtual filesystem mount,
|
|
177
|
+
# e.g. tebako on Windows). Copy the file into the output folder —
|
|
178
|
+
# the child already reads the collection XML from there — and point
|
|
179
|
+
# the directive at the copy. A missing file keeps its value: the
|
|
180
|
+
# child reports that as it always has.
|
|
181
|
+
def directives_host_materialise(val)
|
|
182
|
+
File.exist?(val) or return val
|
|
183
|
+
dst = File.expand_path(File.join(@outdir, File.basename(val)))
|
|
184
|
+
dst == File.expand_path(val) and return val
|
|
185
|
+
FileUtils.mkdir_p(@outdir)
|
|
186
|
+
FileUtils.cp(val, dst)
|
|
187
|
+
dst
|
|
188
|
+
end
|
|
189
|
+
|
|
171
190
|
def flush_files
|
|
172
191
|
warn "\n\n\n\n\nDone: #{DateTime.now.strftime('%H:%M:%S')}"
|
|
173
192
|
warn "\nFiles to delete:\n"
|
|
@@ -62,10 +62,39 @@ module Metanorma
|
|
|
62
62
|
options_in_file[:sourcecode])
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
+
# Document-model transformer specs contributed by the active taste
|
|
66
|
+
# (+options[:supplied_type]+), or +{}+. Lets a taste (e.g. OIML) make its
|
|
67
|
+
# own output format selectable and choose its presentation/semantic leg,
|
|
68
|
+
# via the taste-aware metanorma-core Processor (metanorma-core#12).
|
|
69
|
+
def taste_transformers(options)
|
|
70
|
+
taste = options[:supplied_type]
|
|
71
|
+
return {} unless taste && defined?(Metanorma::TasteRegister) &&
|
|
72
|
+
Metanorma::TasteRegister.respond_to?(:document_transformers_for)
|
|
73
|
+
|
|
74
|
+
Metanorma::TasteRegister.document_transformers_for(taste) || {}
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# The processor's output formats merged with the suffixes of any
|
|
78
|
+
# taste-contributed document-model formats, so those formats pass
|
|
79
|
+
# extension validation and get an output suffix.
|
|
80
|
+
def effective_output_formats(options)
|
|
81
|
+
@processor.output_formats.merge(
|
|
82
|
+
taste_transformers(options)
|
|
83
|
+
.transform_values { |spec| spec[:suffix] }.compact,
|
|
84
|
+
)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Whether +ext+ is generated from presentation XML, honouring both the
|
|
88
|
+
# processor's own answer and a taste transformer's +:presentation+ flag.
|
|
89
|
+
def uses_presentation_xml?(ext, options)
|
|
90
|
+
@processor.use_presentation_xml(ext) ||
|
|
91
|
+
(taste_transformers(options)[ext] || {})[:presentation] == true
|
|
92
|
+
end
|
|
93
|
+
|
|
65
94
|
def get_extensions(options)
|
|
66
95
|
ext = extract_extensions(options)
|
|
67
96
|
!ext.include?(:presentation) && ext.any? do |e|
|
|
68
|
-
|
|
97
|
+
uses_presentation_xml?(e, options)
|
|
69
98
|
end and ext << :presentation
|
|
70
99
|
!ext.include?(:rxl) && options[:site_generate] and
|
|
71
100
|
ext << :rxl
|
|
@@ -73,10 +102,11 @@ module Metanorma
|
|
|
73
102
|
end
|
|
74
103
|
|
|
75
104
|
def extract_extensions(options)
|
|
105
|
+
formats = effective_output_formats(options)
|
|
76
106
|
options[:extension_keys] ||=
|
|
77
|
-
|
|
107
|
+
formats.reduce([]) { |memo, (k, _)| memo << k }
|
|
78
108
|
options[:extension_keys].reduce([]) do |memo, e|
|
|
79
|
-
if
|
|
109
|
+
if formats[e] then memo << e
|
|
80
110
|
else
|
|
81
111
|
unsupported_format_error(e)
|
|
82
112
|
memo
|
|
@@ -123,6 +153,9 @@ module Metanorma
|
|
|
123
153
|
def copy_isodoc_options_attrs(options, ret)
|
|
124
154
|
ret[:datauriimage] = true if options[:datauriimage]
|
|
125
155
|
ret[:sourcefilename] = options[:filename]
|
|
156
|
+
# Carry the active taste through to Processor#output, so its taste-aware
|
|
157
|
+
# document_transformers resolve there (metanorma-core#12).
|
|
158
|
+
ret[:supplied_type] = options[:supplied_type]
|
|
126
159
|
%i(bare sectionsplit sectionsplit_filename install_fonts baseassetpath
|
|
127
160
|
aligncrosselements tocfigures toctables tocrecommendations tocexamples
|
|
128
161
|
strict fonts)
|
|
@@ -67,7 +67,7 @@ module Metanorma
|
|
|
67
67
|
# Process a single extension (output format)
|
|
68
68
|
def process_ext(ext, source_file, semantic_xml, bibdata, output_paths,
|
|
69
69
|
options)
|
|
70
|
-
output_paths[:ext] =
|
|
70
|
+
output_paths[:ext] = effective_output_formats(options)[ext]
|
|
71
71
|
output_paths[:out] = @output_filename.for_format(ext) ||
|
|
72
72
|
output_paths[:xml].sub(/\.[^.]+$/, ".#{output_paths[:ext]}")
|
|
73
73
|
isodoc_options = get_isodoc_options(source_file, options, ext)
|
|
@@ -78,7 +78,7 @@ module Metanorma
|
|
|
78
78
|
)
|
|
79
79
|
|
|
80
80
|
# Otherwise, determine if it uses presentation XML
|
|
81
|
-
if
|
|
81
|
+
if uses_presentation_xml?(ext, options)
|
|
82
82
|
# Format requires presentation XML first, then convert to final format
|
|
83
83
|
process_via_presentation_xml(ext, output_paths, options, isodoc_options)
|
|
84
84
|
else
|
data/lib/metanorma/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +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.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: bin
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-08-30 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: asciidoctor
|
|
@@ -211,9 +212,9 @@ email:
|
|
|
211
212
|
executables: []
|
|
212
213
|
extensions: []
|
|
213
214
|
extra_rdoc_files:
|
|
215
|
+
- README.adoc
|
|
214
216
|
- CHANGELOG.adoc
|
|
215
217
|
- LICENSE.txt
|
|
216
|
-
- README.adoc
|
|
217
218
|
files:
|
|
218
219
|
- ".envrc"
|
|
219
220
|
- ".gitignore"
|
|
@@ -277,6 +278,7 @@ homepage: https://github.com/metanorma/metanorma
|
|
|
277
278
|
licenses:
|
|
278
279
|
- BSD-2-Clause
|
|
279
280
|
metadata: {}
|
|
281
|
+
post_install_message:
|
|
280
282
|
rdoc_options: []
|
|
281
283
|
require_paths:
|
|
282
284
|
- lib
|
|
@@ -291,7 +293,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
291
293
|
- !ruby/object:Gem::Version
|
|
292
294
|
version: '0'
|
|
293
295
|
requirements: []
|
|
294
|
-
rubygems_version:
|
|
296
|
+
rubygems_version: 3.5.22
|
|
297
|
+
signing_key:
|
|
295
298
|
specification_version: 4
|
|
296
299
|
summary: Metanorma is the standard of standards; the metanorma gem allows you to create
|
|
297
300
|
any standard document type supported by Metanorma.
|