From c98283e3919f39c093e1eb51f80e6f259a7fd103 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 10 Feb 2017 16:51:55 -0500 Subject: output, sisupod & a few switches --- src/sdp/source_sisupod.d | 69 +++++++++++++++++++++--------------------------- 1 file changed, 30 insertions(+), 39 deletions(-) (limited to 'src/sdp/source_sisupod.d') diff --git a/src/sdp/source_sisupod.d b/src/sdp/source_sisupod.d index 9ed2c97..8a24d55 100644 --- a/src/sdp/source_sisupod.d +++ b/src/sdp/source_sisupod.d @@ -21,9 +21,9 @@ template SiSUpod() { import ao_rgx, output_xhtmls; - void SiSUpod(T)(T doc_matters) { debug(asserts){ + // static assert(is(typeof(doc_matters) == tuple)); } mixin SiSUrgxInit; mixin SiSUpaths; @@ -31,23 +31,6 @@ template SiSUpod() { mixin SiSUlanguageCodes; auto lang = Lang(); auto rgx = Rgx(); - /+ - dir structure - /tmp/_sisu_processing_/ralph/sisupod - ├── conf - ├── css (unless should be within conf?) - ├── doc - │ ├── en - │ ├── es - │ ├── fr - │   └── zh - └── image - - - tasks - - create directory structure - - map other language directories - - check for corresponding files within - +/ assert (match(doc_matters.source_filename, rgx.src_fn)); try { /+ create directory structure +/ @@ -63,51 +46,61 @@ template SiSUpod() { if (!exists(pth_sisupod.image(doc_matters.source_filename))) { mkdirRecurse(pth_sisupod.image(doc_matters.source_filename)); } - /+ copy relevant files +/ + if (!exists(pth_sisupod.doc_lng(doc_matters.source_filename, doc_matters.language))) { + mkdirRecurse(pth_sisupod.doc_lng(doc_matters.source_filename, doc_matters.language)); + } debug(sisupod) { writeln(__LINE__, ": ", // doc_matters.environment["pwd"], "/", doc_matters.source_filename, " -> ", // doc_matters.environment["pwd"], "/", - pth_sisupod.fn_doc(doc_matters.source_filename, "en") - ); - } - // need to extract language code directories (from directory structure or filenames & have a default) - if (!exists(pth_sisupod.doc_lng(doc_matters.source_filename, "en"))) { - mkdirRecurse(pth_sisupod.doc_lng(doc_matters.source_filename, "en")); + pth_sisupod.fn_doc( + doc_matters.source_filename, + doc_matters.language + )); } if (exists(doc_matters.source_filename)) { - copy(doc_matters.source_filename, - pth_sisupod.fn_doc(doc_matters.source_filename, "en")); + copy( + doc_matters.source_filename, + pth_sisupod.fn_doc( + doc_matters.source_filename, + doc_matters.language + )); } if (doc_matters.file_insert_list.length > 0) { foreach (insert_file; doc_matters.file_insert_list) { debug(sisupod) { writeln( - // doc_matters.environment["pwd"], "/", insert_file, " -> ", - // doc_matters.environment["pwd"], "/", - pth_sisupod.fn_doc(doc_matters.source_filename, "en") - ); + pth_sisupod.fn_doc_insert( + doc_matters.source_filename, + insert_file, + doc_matters.language + )); } if (exists(insert_file)) { - copy(insert_file, - pth_sisupod.fn_doc(doc_matters.source_filename, "en")); + copy( + insert_file, + pth_sisupod.fn_doc_insert( + doc_matters.source_filename, + insert_file, + doc_matters.language + )); } } } foreach (image; doc_matters.image_list) { debug(sisupod) { writeln( - // doc_matters.environment["pwd"], "/", "_sisu/image/", image, " -> ", - // doc_matters.environment["pwd"], "/", pth_sisupod.image(doc_matters.source_filename), "/", image ); } if (exists("_sisu/image/"~ image)) { - copy(("_sisu/image/"~ image), - (pth_sisupod.image(doc_matters.source_filename) ~ "/" ~ image)); + copy( + ("_sisu/image/"~ image), + (pth_sisupod.image(doc_matters.source_filename) ~ "/" ~ image) + ); } } } @@ -115,6 +108,4 @@ template SiSUpod() { // Handle error } } - - } -- cgit v1.2.3