aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdp/source_sisupod.d
diff options
context:
space:
mode:
Diffstat (limited to 'src/sdp/source_sisupod.d')
-rw-r--r--src/sdp/source_sisupod.d86
1 files changed, 69 insertions, 17 deletions
diff --git a/src/sdp/source_sisupod.d b/src/sdp/source_sisupod.d
index 1edbbfc..9ed2c97 100644
--- a/src/sdp/source_sisupod.d
+++ b/src/sdp/source_sisupod.d
@@ -22,11 +22,8 @@ template SiSUpod() {
ao_rgx,
output_xhtmls;
- void SiSUpod(S)(
- S fn_src,
- ) {
+ void SiSUpod(T)(T doc_matters) {
debug(asserts){
- static assert(is(typeof(fn_src) == string));
}
mixin SiSUrgxInit;
mixin SiSUpaths;
@@ -36,28 +33,83 @@ template SiSUpod() {
auto rgx = Rgx();
/+
dir structure
- /tmp/_sisu_processing_/ralph/en/sisupod
+ /tmp/_sisu_processing_/ralph/sisupod
+ ├── conf
+ ├── css (unless should be within conf?)
├── doc
- │   └── en
+ │ ├── en
+ │ ├── es
+ │ ├── fr
+ │   └── zh
└── image
- - create directory structure
-
+ - tasks
+ - create directory structure
+ - map other language directories
+ - check for corresponding files within
+/
- assert (match(fn_src, rgx.src_fn));
+ assert (match(doc_matters.source_filename, rgx.src_fn));
try {
/+ create directory structure +/
- mkdirRecurse(pth_sisupod.doc(fn_src));
- mkdirRecurse(pth_sisupod.conf(fn_src));
- mkdirRecurse(pth_sisupod.css(fn_src));
- mkdirRecurse(pth_sisupod.image(fn_src));
+ 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 +/
- auto f_out = pth_sisupod.fn_doc(fn_src, "en"); // you need fn without path and then to insert back language code for output sub-directory
debug(sisupod) {
- writeln(__LINE__, ": ", fn_src, " -> ", f_out);
+ 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));
+ }
}
- mkdirRecurse(pth_sisupod.doc_lng(fn_src, "en")); // need to extract language code directories (from directory structure or filenames & have a default)
- copy(fn_src, f_out);
}
catch (ErrnoException ex) {
// Handle error