aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sisudoc/outputs
diff options
context:
space:
mode:
Diffstat (limited to 'src/sisudoc/outputs')
-rw-r--r--src/sisudoc/outputs/io_out/metadata.d8
-rw-r--r--src/sisudoc/outputs/io_out/source_pod.d25
2 files changed, 25 insertions, 8 deletions
diff --git a/src/sisudoc/outputs/io_out/metadata.d b/src/sisudoc/outputs/io_out/metadata.d
index a63422f..5a10c64 100644
--- a/src/sisudoc/outputs/io_out/metadata.d
+++ b/src/sisudoc/outputs/io_out/metadata.d
@@ -510,8 +510,8 @@ string theme_light_1 = format(q"┃
metadata_ ~= "</p>";
if (doc_matters.opt.action.html_link_markup_source) {
metadata_ ~= "<hr /><p class=\"lev1\">source: " ~ doc_matters.src.filename_base ~ "</p>";
- metadata_ ~= "<p class=\"lev1\">●&nbsp;&nbsp;markup source:&nbsp;&nbsp;the&nbsppod&nbsp[<a href=\"../../" ~ pth_pod.internal_base ~ "/" ~ doc_matters.src.filename_base ~ ".zip\" class=\"lnkicon\">"
- ~ "&nbsp;🫛&nbsp;zipped&nbsp;</a>|&nbsp;"
+ metadata_ ~= "<p class=\"lev1\">●&nbsp;&nbsp;markup source:&nbsp;&nbsp;the&nbsppod&nbsp[<a href=\"../../" ~ pth_pod.internal_base ~ "/" ~ doc_matters.src.filename_base ~ pod_archive_suffix ~ "\" class=\"lnkicon\">"
+ ~ "&nbsp;🫛&nbsp;sisupod&nbsp;</a>|&nbsp;"
~ "<a href=\"../../" ~ pth_pod.internal_base ~ "/" ~ doc_matters.src.filename_base ~ "/\" class=\"lnkicon\">"
~ "&nbsp;🫛&nbsp;tree&nbsp;</a>]&nbsp;";
{
@@ -533,10 +533,10 @@ string theme_light_1 = format(q"┃
try { // get sha digest for pod
metadata_ ~= "<p class=\"lev2\">";
auto data = (cast(byte[]) (fn_pod).read); // prevents code from being safe
- metadata_ ~= "<tt>" ~ data.sha256Of.toHexString ~ "::" ~ data.length.to!string ~ "</tt> - " ~ doc_matters.src.filename_base ~ ".zip";
+ metadata_ ~= "<tt>" ~ data.sha256Of.toHexString ~ "::" ~ data.length.to!string ~ "</tt> - " ~ doc_matters.src.filename_base ~ pod_archive_suffix;
metadata_ ~= "</p>";
} catch (Exception ex) {
- writeln("WARNING, source doc_matters.src.filename_base not found: ", doc_matters.src.filename_base, ".zip\n ", fn_pod);
+ writeln("WARNING, source doc_matters.src.filename_base not found: ", doc_matters.src.filename_base, pod_archive_suffix, "\n ", fn_pod);
}
}
if (doc_matters.opt.action.ocda_db) {
diff --git a/src/sisudoc/outputs/io_out/source_pod.d b/src/sisudoc/outputs/io_out/source_pod.d
index 667e809..b929e06 100644
--- a/src/sisudoc/outputs/io_out/source_pod.d
+++ b/src/sisudoc/outputs/io_out/source_pod.d
@@ -546,16 +546,33 @@ template spinePod() {
return zip;
}
void zipArchive(M,F,Z)(M doc_matters, F fn_pod, Z zip) {
+ import sisudoc.ocda.zstd : zstdCompress, ZstdException;
auto fn_src_in = doc_matters.src.filename;
if (doc_matters.opt.action.pod) {
if (exists(doc_matters.src.file_with_absolute_path)) {
try {
- createZipFile!()(fn_pod, zip.build());
+ /+ ↓ the archive is built exactly as before and then wrapped in one
+ zstd frame. The wrap is here and not in createZipFile, which
+ also writes every epub and every odt: those are real zips by
+ their own specifications.
+ .
+ The compression gain is in whole-stream rather than per-member
+ compression. A zip deflates each member on its own with a 32 KB
+ window, which sees none of the redundancy between multiple language
+ versions of a document and the catalogues that may repeat the
+ English (original language): (live-manual is 10.31x smaller this
+ way, where per-member deflate manages about 3x).
+ +/
+ auto _archive = cast(ubyte[]) zip.build();
+ createZipFile!()(fn_pod,
+ cast(void[]) zstdCompress(_archive, doc_matters.opt.action.pod_compression));
+ } catch (ZstdException ex) {
+ writeln("WARNING failed to compress pod archive: ", fn_pod, " - ", ex.msg);
} catch (ErrnoException ex) {
// Handle errors
}
} else { writeln("WARNING check missing source file(s): ", doc_matters.opt.action.pod); }
- if (!(exists(fn_pod))) { writeln("WARNING failed to create pod zip archive: ", fn_pod); }
+ if (!(exists(fn_pod))) { writeln("WARNING failed to create pod archive: ", fn_pod); }
}
}
void zipArchiveDigest(M,F,D)(M doc_matters, F fn_pod, D _digests) {
@@ -578,9 +595,9 @@ template spinePod() {
if (exists(fn_pod)) {
try {
auto data = (cast(byte[]) (fn_pod).read);
- // if (doc_matters.opt.action.vox_gt_2) { writeln(" ", doc_matters.src.filename, " > ", doc_matters.src.filename_base, ".zip"); }
+ // if (doc_matters.opt.action.vox_gt_2) { writeln(" ", doc_matters.src.filename, " > ", doc_matters.src.filename_base, pod_archive_suffix); }
if (doc_matters.opt.action.pod) {
- _zip_digest = (data.sha256Of.toHexString ~ "::" ~ data.length.to!string ~ " - " ~ doc_matters.src.filename_base ~ ".zip");
+ _zip_digest = (data.sha256Of.toHexString ~ "::" ~ data.length.to!string ~ " - " ~ doc_matters.src.filename_base ~ pod_archive_suffix);
if (doc_matters.opt.action.vox_gt_1) { writeln(" ", _zip_digest); }
if (doc_matters.opt.action.vox_gt_1) { writeln(" ", pths_pod.pod_dir_(), "/", doc_matters.src.filename_base, "/"); }
if (doc_matters.opt.action.vox_gt_1) { writeln(" ", _digest_fn); }