metanorma 2.1.9 → 2.1.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6f662b6213511d30fb8f16f0bc51bb4209959a4f17ac385d81bdd02f1135088
4
- data.tar.gz: 4021db66267ad5cbc213058d7b2252d6a2f9572e6efd686df2f84ba1f1965cbb
3
+ metadata.gz: b8d17619f5a369f5df52db09ddae40490b5ceb22cd3932e22b8fa382d3bd078d
4
+ data.tar.gz: b4ecb80e39e4d282b0d1a6ccb6523aeb519b2431211de5510f4fad81f09db04e
5
5
  SHA512:
6
- metadata.gz: 6ba138f8fd28e6e4ee1d0fcc786f49b17b816483c39a6d2dda89643b9611bed93068ac8f3e700ba199a01f0f0446ce2c46be97d4a7e705a67df04e6b1d898432
7
- data.tar.gz: 45a50ed06452ff4e598bc95ce07412eeca39b33afe7158a48f17080381417cda79ba4ed4286901652a6e4f6311d0ad70e083388aba4e3150c22f543f56825dde
6
+ metadata.gz: 8b8fd5e20992cd0508fbcdb96ce7e4c0b2fca460a9ae1f8b7231ed2e43a4e15f3536fd30b7b717d1c3a00a8065e0064749eff22726c7100aae26301f606a7b69
7
+ data.tar.gz: 476bd02101c3f23e99b6c414f839e442351adf137ddc2e922c6ae822ea95e7d6f5c66f98f062bfe51299d9ffb28a00f81dd8fefce5f42ac4ba94c39ac8755c32
@@ -124,6 +124,27 @@ module Metanorma
124
124
  end
125
125
  end
126
126
 
127
+ def self.flavor_from_yaml(yaml)
128
+ yaml["directives"]&.detect do |x|
129
+ x.is_a?(Hash) && x.has_key?("flavor")
130
+ end&.dig("flavor")&.upcase
131
+ end
132
+
133
+ def self.flavor_to_bibdata(file)
134
+ # propagate flavor from directives to bibdata
135
+ yaml = YAML.safe_load(file)
136
+ flavor = flavor_from_yaml(yaml) or return file
137
+ yaml["bibdata"] or return file
138
+ yaml["bibdata"]["ext"] ||= {}
139
+ yaml["bibdata"]["ext"]["flavor"] ||= flavor
140
+ yaml.to_yaml
141
+ end
142
+
143
+ def self.from_yaml(file)
144
+ file = flavor_to_bibdata(file)
145
+ super
146
+ end
147
+
127
148
  include Converters
128
149
  end
129
150
  end
@@ -165,18 +165,19 @@ module Metanorma
165
165
  f = (Pathname.new file).absolute? ? file : File.join(@dir, file)
166
166
  File.exist?(f) or raise AdocFileNotFoundException.new "#{f} not found!"
167
167
  compile_adoc_file?(file) or return
168
- ::Metanorma::Util.log("[metanorma] Info: Compiling #{f}...", :info)
168
+ ::Metanorma::Util.log("[metanorma] Info: Compiling #{f}...", :warning)
169
169
  ::Metanorma::Compile.new
170
170
  .compile(f, agree_to_terms: true, install_fonts: false,
171
171
  extension_keys: [:xml])
172
- ::Metanorma::Util.log("[metanorma] Info: Compiling #{f}...done!", :info)
172
+ ::Metanorma::Util.log("[metanorma] Info: Compiling #{f}...done!", :warning)
173
173
  end
174
174
 
175
175
  def compile_adoc_file?(file)
176
+ !File.exist?(file.sub(/\.adoc$/, ".xml")) and return true
176
177
  @collection.directives.detect do |d|
177
- d.key == "recompile-xml"
178
- end and return true
179
- !File.exist?(file.sub(/\.adoc$/, ".xml"))
178
+ d.key == "recompile-xml" && d.value == "false"
179
+ end and return false
180
+ true
180
181
  end
181
182
 
182
183
  def documents(mnf = @config)
@@ -1,3 +1,3 @@
1
1
  module Metanorma
2
- VERSION = "2.1.9".freeze
2
+ VERSION = "2.1.10".freeze
3
3
  end
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.1.9
4
+ version: 2.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-21 00:00:00.000000000 Z
11
+ date: 2025-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor