suma 0.5.15 → 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 +4 -4
- data/lib/suma/staged_collection_builder.rb +28 -2
- data/lib/suma/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e5c15270fcd8076bab49e6fdf940d0f83fb2ad3ca4b3f274ac156eef6af5a8f0
|
|
4
|
+
data.tar.gz: b33b2aae6fbb4322fe010643b65326dad5683c265e3907d78bcaa39ad2fd0ad6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 93696359dfff9571f9705661a1ce6f40f8f78e4eb222dec2d34f4d7a030a6aa7962e091ed9d2688352ab80b31deb730989bedde47871d2c1a7c6e73fb656fffc
|
|
7
|
+
data.tar.gz: 2557f73a80035a6b77f7b35d7289044e5792ee78e91d8edf26b2f293f24013e995991ef079a62a78ebd612d9dcfc13f6ddce8ba0d1b0f61411820138db3bbd96
|
|
@@ -174,7 +174,9 @@ module Suma
|
|
|
174
174
|
# docref (docrefs carrying metanorma's GUID marker) were
|
|
175
175
|
# therefore unrecoverable ("no stored artefact"). Alias the
|
|
176
176
|
# artefacts this render produced under the docref slug too.
|
|
177
|
-
|
|
177
|
+
# Shape: single_member_manifest => {"manifest" =>
|
|
178
|
+
# {"manifest" => [{"docref" => [dr]}]}}.
|
|
179
|
+
member_id = manifest.dig("manifest", "manifest", 0, "docref", 0, "identifier")
|
|
178
180
|
id_slug = member_id.to_s
|
|
179
181
|
.gsub(/[^A-Za-z0-9._-]+/, "-").gsub(/-{2,}/, "-")
|
|
180
182
|
.gsub(/\A-|-\z/, "")
|
|
@@ -182,15 +184,39 @@ module Suma
|
|
|
182
184
|
.select { |f| f.end_with?(".semantic.xml") }
|
|
183
185
|
compile = { install_fonts: false }
|
|
184
186
|
compile[:novalid] = true if no_valid == "1"
|
|
185
|
-
Metanorma::Collection.parse(one_path)
|
|
187
|
+
collection = Metanorma::Collection.parse(one_path)
|
|
188
|
+
collection.render(
|
|
186
189
|
format: [:xml], output_folder: out,
|
|
187
190
|
preserve_unresolved: true, artifact_store_dir: store_dir,
|
|
188
191
|
compile: compile,
|
|
189
192
|
)
|
|
190
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
|
|
191
200
|
produced = Dir.children(store_dir).select do |f|
|
|
192
201
|
f.end_with?(".semantic.xml")
|
|
193
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
|
|
194
220
|
produced.each do |f|
|
|
195
221
|
if (m = f.match(/\A(.*).([0-9a-f]+).semantic.xml\z/))
|
|
196
222
|
alias_name = "\#{id_slug}.\#{m[2]}.semantic.xml"
|
data/lib/suma/version.rb
CHANGED