metanorma 2.5.2 → 2.5.3
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/compile/compile_options.rb +36 -3
- data/lib/metanorma/compile/render.rb +2 -2
- data/lib/metanorma/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4882b98a473b69b9729ddc48af5d8754c0c3cc2e0e64ba9ef06482b7f9671eb0
|
|
4
|
+
data.tar.gz: ccbc44588f0a8610e5d6cff9c73dce8a90d66b8d65678ae9b1cf884a179ab453
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6d14656e113f0eac2e715ba4f7d51b5fb57e2029a54cb947f94b47fbe4ce7f0e3ba0334b92474d74c4fc1d5ad699efd61e8e3f5cfbf1850e5ca31a5066753b38
|
|
7
|
+
data.tar.gz: f579166fec3baaae273925ad3fa63e60e85240f468b696948a50cffd435ee5c444f07482373c7605fe3200ba7f82b34da345bb93dbe2c6831d3d8e92b5c94117
|
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
|
|
@@ -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,7 +1,7 @@
|
|
|
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.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -291,7 +291,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
291
291
|
- !ruby/object:Gem::Version
|
|
292
292
|
version: '0'
|
|
293
293
|
requirements: []
|
|
294
|
-
rubygems_version: 4.0.
|
|
294
|
+
rubygems_version: 4.0.16
|
|
295
295
|
specification_version: 4
|
|
296
296
|
summary: Metanorma is the standard of standards; the metanorma gem allows you to create
|
|
297
297
|
any standard document type supported by Metanorma.
|