aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdp/output/paths_source.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2017-11-29 18:37:41 -0500
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:14 -0400
commit23920cdf33513ead479801568735f4d6545422aa (patch)
tree6be80cc175d8d32fde9aeb6488f76b5d7dc87723 /src/sdp/output/paths_source.d
parentpaths, manifest (diff)
0.21.0 paths, pod manifest source alternativedoc-reform_v0.0.21
- 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
Diffstat (limited to 'src/sdp/output/paths_source.d')
-rw-r--r--src/sdp/output/paths_source.d125
1 files changed, 110 insertions, 15 deletions
diff --git a/src/sdp/output/paths_source.d b/src/sdp/output/paths_source.d
index de14b23..c22efe0 100644
--- a/src/sdp/output/paths_source.d
+++ b/src/sdp/output/paths_source.d
@@ -15,11 +15,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() {
@@ -30,8 +30,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;
}
@@ -43,6 +42,105 @@ template PodManifest() {
return ManifestFile_();
}
}
+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_();
+ }
+}
template ConfigFilePaths() {
mixin SiSUrgxInit;
static auto rgx = Rgx();
@@ -174,10 +272,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;
@@ -332,7 +427,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;
@@ -378,10 +473,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_;
@@ -393,10 +488,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_;