diff options
Diffstat (limited to 'src/sisudoc/io_out/source_pod.d')
| -rw-r--r-- | src/sisudoc/io_out/source_pod.d | 65 |
1 files changed, 37 insertions, 28 deletions
diff --git a/src/sisudoc/io_out/source_pod.d b/src/sisudoc/io_out/source_pod.d index c77ce45..138f105 100644 --- a/src/sisudoc/io_out/source_pod.d +++ b/src/sisudoc/io_out/source_pod.d @@ -72,6 +72,15 @@ template spinePod() { assert (doc_matters.src.filename.match(rgx_files.src_fn)); if (doc_matters.opt.action.source_or_pod) { try { + /+ ↓ clean slate: remove per-document pod directory before regeneration, + but only on the first language of a multi-language document, + so that subsequent languages' files are not wiped +/ + if (doc_matters.src.language == doc_matters.pod.manifest_list_of_languages[0]) { + string doc_pod_dir = pths_pod.base_filesystem_(doc_matters.src.filename); + if (exists(doc_pod_dir) && doc_pod_dir.isDir) { + doc_pod_dir.rmdirRecurse; + } + } { podArchive_directory_tree(doc_matters, pths_pod); } @@ -114,8 +123,10 @@ template spinePod() { if (!exists(pths_pod.css(doc_matters.src.filename).filesystem_open_zpod)) { pths_pod.css(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse; } - if (!exists(pths_pod.abstraction_root(doc_matters.src.filename).filesystem_open_zpod)) { - pths_pod.abstraction_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse; + if (doc_matters.opt.action.pod2) { + if (!exists(pths_pod.abstraction_root(doc_matters.src.filename).filesystem_open_zpod)) { + pths_pod.abstraction_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse; + } } if (!exists(pths_pod.image_root(doc_matters.src.filename).filesystem_open_zpod)) { pths_pod.image_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse; @@ -182,34 +193,32 @@ template spinePod() { } } } - } { // bundle abstraction .ssp file - import sisudoc.io_out.paths_output; - auto out_pth = spineOutPaths!()(doc_matters.output_path, doc_matters.src.language); - string abstraction_dir = ((out_pth.output_base.chainPath("abstraction")).asNormalizedPath).array; - string ssp_filename = doc_matters.src.doc_uid_out ~ ".ssp"; - string fn_src_in = ((abstraction_dir.chainPath(ssp_filename)).asNormalizedPath).array.to!string; - auto fn_src_out_pod_zip_base - = pths_pod.abstraction_root(doc_matters.src.filename).zpod.to!string - ~ "/" ~ ssp_filename; - auto fn_src_out_filesystem - = pths_pod.abstraction_root(doc_matters.src.filename).filesystem_open_zpod.to!string - ~ "/" ~ ssp_filename; - if (exists(fn_src_in)) { - debug(io) { writeln("(io debug) src out found: ", fn_src_in); } - { // take DIGEST write to pod file digests.txt - auto data = (cast(byte[]) (fn_src_in).read); - _digests[doc_matters.src.language]["ssp"] ~= data.sha256Of.toHexString - ~ "::" ~ data.length.to!string ~ " - " ~ ssp_filename ~ "\n"; - } - if (doc_matters.opt.action.source_or_pod) { + } { // bundle abstraction .ssp file (only for --pod2) + if (doc_matters.opt.action.pod2) { + import sisudoc.io_out.paths_output; + auto out_pth = spineOutPaths!()(doc_matters.output_path, doc_matters.src.language); + string abstraction_dir = ((out_pth.output_base.chainPath("abstraction")).asNormalizedPath).array; + string ssp_filename = doc_matters.src.doc_uid_out ~ ".ssp"; + string fn_src_in = ((abstraction_dir.chainPath(ssp_filename)).asNormalizedPath).array.to!string; + auto fn_src_out_pod_zip_base + = pths_pod.abstraction_root(doc_matters.src.filename).zpod.to!string + ~ "/" ~ ssp_filename; + auto fn_src_out_filesystem + = pths_pod.abstraction_root(doc_matters.src.filename).filesystem_open_zpod.to!string + ~ "/" ~ ssp_filename; + if (exists(fn_src_in)) { + debug(io) { writeln("(io debug) src out found: ", fn_src_in); } + { // take DIGEST write to pod file digests.txt + auto data = (cast(byte[]) (fn_src_in).read); + _digests[doc_matters.src.language]["ssp"] ~= data.sha256Of.toHexString + ~ "::" ~ data.length.to!string ~ " - " ~ ssp_filename ~ "\n"; + } fn_src_in.copy(fn_src_out_filesystem); - } - if (doc_matters.opt.action.source_or_pod) { zip = podArchive("file_path_text", fn_src_in, fn_src_out_pod_zip_base, zip); - } - } else { - if (doc_matters.opt.action.debug_do_pod && doc_matters.opt.action.vox_gt_2) { - writeln("WARNING (io) src out NOT found (abstraction): ", fn_src_in); + } else { + if (doc_matters.opt.action.debug_do_pod && doc_matters.opt.action.vox_gt_2) { + writeln("WARNING (io) src out NOT found (abstraction): ", fn_src_in); + } } } } { // bundle dr_document_make |
