From 23920cdf33513ead479801568735f4d6545422aa Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 29 Nov 2017 18:37:41 -0500 Subject: 0.21.0 paths, pod manifest source alternative - sisupod.manifest - list alternative processable files with paths e.g.: media/text/en/live-manual.ssm media/text/fr/live-manual.ssm ... - name file followed by list of language codes e.g.: live-manual.ssm en, ca, de, es, fr, it, ja, pl, ro live-manual_next.ssm en, de, es, fr, it, ja --- org/default_paths.org | 133 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 117 insertions(+), 16 deletions(-) (limited to 'org/default_paths.org') diff --git a/org/default_paths.org b/org/default_paths.org index 623584e..b2c1980 100644 --- a/org/default_paths.org +++ b/org/default_paths.org @@ -46,11 +46,11 @@ template PodManifest() { mixin SiSUrgxInit; static auto rgx = Rgx(); auto PodManifest(P)( - P _pth, + P _pth = "", ) { struct ManifestFile_ { auto pod_manifest_filename() { - string _manifest_file = "sisudoc.txt"; + string _manifest_file = "sisupod.manifest"; return _manifest_file; } auto pod_manifest_path() { @@ -61,8 +61,7 @@ template PodManifest() { } else if (_pth.match(rgx.src_pth_contents) && (_pth.isFile)) { _manifest_path = dirName(_pth); - } else { - // _manifest_path = ""; + // } else { // _manifest_path = ""; } return _manifest_path; } @@ -76,6 +75,111 @@ template PodManifest() { } #+END_SRC +** _manifest and source files_ :manifest: + +#+name: template_paths_src +#+BEGIN_SRC d +template PodManifestAndSrcFile() { + mixin SiSUrgxInit; + static auto rgx = Rgx(); + auto PodManifestAndSrcFile(O,E,P,F)( + O _opt_actions, + E _env, + P _pth = "", + F _fns = "", + char[][] _manifest_fn_list = [[]], + ) { + auto _manifest = PodManifest!()(_pth); + struct ManifestFilePlus_ { + auto pwd() { + return _env["pwd"]; + } + auto home() { + return _env["home"]; + } + auto opt_action() { + return _opt_actions; + } + auto is_pod() { + auto _is_pod = (_manifest.pod_manifest_path.length > 0) ? true : false; + return _is_pod; + } + auto pod_manifest_list_of_filenames() { + return _manifest_fn_list; + } + auto pod_manifest_list_of_languages() { + string[] _lngs; + foreach (filename_; pod_manifest_list_of_filenames) { + string _k = "en"; + if (auto m = (filename_).match(rgx.language_code_and_filename)) { + _k = m.captures[1].to!string; + } + _lngs ~= _k; // all the languages from the manifest list of filenames with paths + } + return _lngs; + } + auto pod_manifest_filename() { + return _manifest.pod_manifest_filename; + } + auto pod_manifest_path() { + return _manifest.pod_manifest_path; + } + auto pod_manifest_file_with_path() { + return _manifest.pod_manifest_file_with_path; + } + auto pod_config_dirs() { // TODO + string[] _config_dirs; + return _config_dirs; + } + auto pod_image_dirs() { // TODO + string[] _image_dirs; + return _image_dirs; + } + auto src_fn() { + return _fns; + } + auto src_lng() { + string _k; + if (auto m = (src_fn).match(rgx.language_code_and_filename)) { + _k = m.captures[1]; + } else { + _k = "en"; + } + return _k; + } + auto output_path() { + auto _output_path = pwd; + if ((_opt_actions.output_dir_set.length > 0) + && isValidPath(_opt_actions.output_dir_set) + ) { + _output_path = asNormalizedPath(_opt_actions.output_dir_set).array; + if (!exists(_output_path)) { + _output_path.mkdirRecurse; + } + assert(_output_path.isDir); + } + return _output_path; + } + auto src_config_dirs() { // TODO + string[] _config_dirs; + if (is_pod) { + } else { + } + return _config_dirs; + } + auto src_image_dirs() { // TODO + string[] _image_dirs; + if (is_pod) { + } else { + } + return _image_dirs; + } + } + return ManifestFilePlus_(); + } +} +#+END_SRC + ** _config_ :config: #+name: template_paths_src @@ -136,7 +240,7 @@ sisupod │  │  ├── [conf] │   │ └── [image] │   └── video - └── sisudoc.txt + └── sisupod.manifest _replace:_ @@ -274,10 +378,7 @@ template SiSUpathsSisupods() { string _base_dir_pod = "sisupod"; string _base_dir_doc = "sisudoc"; string _suffix = ".zip"; - auto SiSUpathsSisupods(Ps,Lng)( - Ps src_pth_info, - Lng lng, - ) { + auto SiSUpathsSisupods()() { struct _PodPaths { string base_filename_(string fn_src) { auto pth = fn_src.baseName.stripExtension; @@ -432,7 +533,7 @@ template SiSUpathsSisupods() { } return _pods(); } - auto doc_lng(string fn_src) { + auto doc_lng(string fn_src, string lng) { auto pod_root_ = pod_root(fn_src); auto pth_1_ = text_root(fn_src).zpod.chainPath(lng).array; auto pth_2_ = text_root(fn_src).filesystem_open_zpod.chainPath(lng).array; @@ -478,10 +579,10 @@ template SiSUpathsSisupods() { } return _pods(); } - auto fn_doc(string fn_src) { + auto fn_doc(string fn_src, string lng) { auto pod_root_ = pod_root(fn_src); - auto pth_1_ = doc_lng(fn_src).zpod.chainPath(fn_src.baseName).array; - auto pth_2_ = doc_lng(fn_src).filesystem_open_zpod.chainPath(fn_src.baseName).array; + auto pth_1_ = doc_lng(fn_src, lng).zpod.chainPath(fn_src.baseName).array; + auto pth_2_ = doc_lng(fn_src, lng).filesystem_open_zpod.chainPath(fn_src.baseName).array; struct _pods { auto zpod() { return pth_1_; @@ -493,10 +594,10 @@ template SiSUpathsSisupods() { } return _pods(); } - auto fn_doc_insert(string fn_src, string fn_insert) { + auto fn_doc_insert(string fn_src, string fn_insert, string lng) { auto pod_root_ = pod_root(fn_src); - auto pth_1_ = doc_lng(fn_src).zpod.chainPath(fn_insert.baseName).array; - auto pth_2_ = doc_lng(fn_src).filesystem_open_zpod.chainPath(fn_insert.baseName).array; + auto pth_1_ = doc_lng(fn_src, lng).zpod.chainPath(fn_insert.baseName).array; + auto pth_2_ = doc_lng(fn_src, lng).filesystem_open_zpod.chainPath(fn_insert.baseName).array; struct _pods { auto zpod() { return pth_1_; -- cgit v1.2.3