template SiSUpod() { private import std.algorithm, std.array, std.container, std.exception, std.file, std.getopt, std.json, std.process, std.stdio, std.path, std.range, std.regex, std.string, std.traits, std.typecons, std.uni, std.utf, ao_defaults; import ao_rgx, output_xhtmls; void SiSUpod(T)(T doc_matters) { debug(asserts){ } mixin SiSUrgxInit; mixin SiSUpaths; auto pth_sisupod = SiSUpodPaths(); 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 +/ if (!exists(pth_sisupod.doc(doc_matters.source_filename))) { mkdirRecurse(pth_sisupod.doc(doc_matters.source_filename)); } if (!exists(pth_sisupod.conf(doc_matters.source_filename))) { mkdirRecurse(pth_sisupod.conf(doc_matters.source_filename)); } if (!exists(pth_sisupod.css(doc_matters.source_filename))) { mkdirRecurse(pth_sisupod.css(doc_matters.source_filename)); } if (!exists(pth_sisupod.image(doc_matters.source_filename))) { mkdirRecurse(pth_sisupod.image(doc_matters.source_filename)); } /+ copy relevant files +/ 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")); } if (exists(doc_matters.source_filename)) { copy(doc_matters.source_filename, pth_sisupod.fn_doc(doc_matters.source_filename, "en")); } 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") ); } if (exists(insert_file)) { copy(insert_file, pth_sisupod.fn_doc(doc_matters.source_filename, "en")); } } } 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)); } } } catch (ErrnoException ex) { // Handle error } } }