From a086f413748920c0faeb58b7a211547e92b57bc0 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 27 Jan 2017 10:33:49 -0500 Subject: output templates --- src/sdp/source_sisupod.d | 105 ++++++++++++++++++++++++++++------------------- 1 file changed, 63 insertions(+), 42 deletions(-) (limited to 'src/sdp/source_sisupod.d') diff --git a/src/sdp/source_sisupod.d b/src/sdp/source_sisupod.d index 081bb51..1edbbfc 100644 --- a/src/sdp/source_sisupod.d +++ b/src/sdp/source_sisupod.d @@ -1,47 +1,68 @@ template SiSUpod() { - struct SiSUpod { - - void sisupod_assemble(S)( - S fn_src, - ) { - debug(asserts){ - static assert(is(typeof(fn_src) == string)); - } - mixin SiSUpaths; - auto pth_sisupod = SiSUpodPaths(); - mixin SiSUlanguageCodes; - auto lang = Lang(); - auto rgx = Rgx(); - /+ - dir structure - /tmp/_sisu_processing_/ralph/en/sisupod - ├── doc - │   └── en - └── image - - - create directory structure - - +/ - assert (match(fn_src, 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)); - /+ 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); - } - 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 + 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(S)( + S fn_src, + ) { + debug(asserts){ + static assert(is(typeof(fn_src) == string)); + } + mixin SiSUrgxInit; + mixin SiSUpaths; + auto pth_sisupod = SiSUpodPaths(); + mixin SiSUlanguageCodes; + auto lang = Lang(); + auto rgx = Rgx(); + /+ + dir structure + /tmp/_sisu_processing_/ralph/en/sisupod + ├── doc + │   └── en + └── image + + - create directory structure + + +/ + assert (match(fn_src, 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)); + /+ 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); } + 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 } - - } + + } -- cgit v1.2.3