suma 0.5.16 → 0.5.17

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: d5161adfcf9f143509658ed5c99dbc2e3721204d16c4e98769e0cb8fbc486c7e
4
- data.tar.gz: 02b20891db27c19cec0ed8cd4c4357ec17525c0b915524a94416b4c8170edeb3
3
+ metadata.gz: e5c15270fcd8076bab49e6fdf940d0f83fb2ad3ca4b3f274ac156eef6af5a8f0
4
+ data.tar.gz: b33b2aae6fbb4322fe010643b65326dad5683c265e3907d78bcaa39ad2fd0ad6
5
5
  SHA512:
6
- metadata.gz: fec9c48ab684262c6b753e2900ed9ff884f4d34f18b5327887608cb37a01bde3a7e2ebb3675b552c52a730595c1d36baefc0409d095e186e2f889f312b463d18
7
- data.tar.gz: 17ed78b1bff8d3efdaf40c205cea7c664abc03c2fb440c40291ec2f2a5919d1cba85b7c5eead1c9caa67b24534ec90a6d8f58db6588812a0eb19ba74712e1cc0
6
+ metadata.gz: 93696359dfff9571f9705661a1ce6f40f8f78e4eb222dec2d34f4d7a030a6aa7962e091ed9d2688352ab80b31deb730989bedde47871d2c1a7c6e73fb656fffc
7
+ data.tar.gz: 2557f73a80035a6b77f7b35d7289044e5792ee78e91d8edf26b2f293f24013e995991ef079a62a78ebd612d9dcfc13f6ddce8ba0d1b0f61411820138db3bbd96
@@ -184,15 +184,39 @@ module Suma
184
184
  .select { |f| f.end_with?(".semantic.xml") }
185
185
  compile = { install_fonts: false }
186
186
  compile[:novalid] = true if no_valid == "1"
187
- Metanorma::Collection.parse(one_path).render(
187
+ collection = Metanorma::Collection.parse(one_path)
188
+ collection.render(
188
189
  format: [:xml], output_folder: out,
189
190
  preserve_unresolved: true, artifact_store_dir: store_dir,
190
191
  compile: compile,
191
192
  )
192
193
  unless id_slug.empty?
194
+ # A warm artefact cache makes the render a full cache hit:
195
+ # no new artefact files appear, so a produced-files delta
196
+ # never fires. The collection's own keys are what the
197
+ # renderer stored under, so alias every semantic artefact
198
+ # keyed by them to the docref slug as well.
199
+ store_keys = (collection.bibdatas || {}).keys
193
200
  produced = Dir.children(store_dir).select do |f|
194
201
  f.end_with?(".semantic.xml")
195
202
  end - semantics_before
203
+ if produced.empty?
204
+ store_keys.each do |key|
205
+ src_slug = key.to_s
206
+ .gsub(/[^A-Za-z0-9._-]+/, "-").gsub(/-{2,}/, "-")
207
+ .gsub(/\A-|-\z/, "")
208
+ next if src_slug.empty? || src_slug == id_slug
209
+
210
+ Dir[File.join(store_dir,
211
+ "\#{src_slug}.*.semantic.xml")].each do |f|
212
+ alias_name = f.sub(
213
+ %r{/\#{Regexp.escape(src_slug)}.},
214
+ "/\#{id_slug}.",
215
+ )
216
+ FileUtils.cp(f, alias_name)
217
+ end
218
+ end
219
+ end
196
220
  produced.each do |f|
197
221
  if (m = f.match(/\A(.*).([0-9a-f]+).semantic.xml\z/))
198
222
  alias_name = "\#{id_slug}.\#{m[2]}.semantic.xml"
data/lib/suma/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Suma
4
- VERSION = "0.5.16"
4
+ VERSION = "0.5.17"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: suma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.16
4
+ version: 0.5.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.