aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/io_in/paths_source.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2020-01-05 20:17:17 -0500
committerRalph Amissah <ralph.amissah@gmail.com>2020-02-11 13:08:49 -0500
commitde02319cfa7b4bbff8c111bda02be1a7c6591555 (patch)
tree732c11d10bc2699cd1b72d00b3be943284eea130 /src/doc_reform/io_in/paths_source.d
parentreduce use of auto, much with tuples (diff)
dlang safe default imminent, look ahead
- @safe @trusted & @system, reconsider @trusted
Diffstat (limited to 'src/doc_reform/io_in/paths_source.d')
-rw-r--r--src/doc_reform/io_in/paths_source.d132
1 files changed, 66 insertions, 66 deletions
diff --git a/src/doc_reform/io_in/paths_source.d b/src/doc_reform/io_in/paths_source.d
index 05ceda4..f3b1e8a 100644
--- a/src/doc_reform/io_in/paths_source.d
+++ b/src/doc_reform/io_in/paths_source.d
@@ -16,7 +16,7 @@ import
template PodManifest() {
mixin spineRgxInit;
static auto rgx = Rgx();
- auto PodManifest(O)(
+ @safe auto PodManifest(O)(
O _opt_actions,
string _pth=""
) {
@@ -24,7 +24,7 @@ template PodManifest() {
string pod_manifest_filename() {
return "pod.manifest";
}
- string pod_manifest_path() {
+ @safe string pod_manifest_path() {
string _manifest_path;
if ((isValidPath(_pth) && exists(_pth) != 0 && _pth.isDir)
&& (exists(_pth.chainPath(pod_manifest_filename).array) != 0
@@ -46,10 +46,10 @@ template PodManifest() {
}
return _manifest_path;
}
- string pods_collection_root_path() {
+ @safe string pods_collection_root_path() {
return (pod_manifest_path.length > 0) ? ((chainPath(pod_manifest_path, "..")).asNormalizedPath).array.to!string : "";
}
- string pod_manifest_file_with_path() {
+ @safe string pod_manifest_file_with_path() {
string _k;
if (exists(pod_manifest_path.chainPath(pod_manifest_filename).array)!=0) {
_k = pod_manifest_path.chainPath(pod_manifest_filename).array;
@@ -71,14 +71,14 @@ template PathMatters() {
mixin InternalMarkup;
static auto rgx = Rgx();
static auto mkup = InlineMarkup();
- auto PathMatters(O,E)(
+ @safe auto PathMatters(O,E)(
O _opt_actions,
E _env,
string _pth,
string _fns = "",
char[][] _manifest_fn_list = [[]],
) {
- auto _manifested = PodManifest!()(_opt_actions, _pth);
+ @safe auto _manifested = PodManifest!()(_opt_actions, _pth);
struct ManifestMatters_ {
auto env() {
auto _env = _env;
@@ -92,7 +92,7 @@ template PathMatters() {
}
return Env_();
}
- auto opt() {
+ @safe auto opt() {
struct Opt_ {
auto action() {
return _opt_actions;
@@ -100,45 +100,45 @@ template PathMatters() {
}
return Opt_();
}
- bool src_is_pod() {
+ @safe bool src_is_pod() {
return (_manifested.pod_manifest_path.length > 0) ? true : false;
}
- auto pod() {
+ @safe auto pod() {
struct Pod_ {
- bool src_is_pod() {
+ @safe bool src_is_pod() {
return (_manifested.pod_manifest_path.length > 0) ? true : false;
}
- string collection_root() {
+ @safe string collection_root() {
return _manifested.pods_collection_root_path;
}
- string manifest_filename() {
+ @safe string manifest_filename() {
return _manifested.pod_manifest_filename;
}
- string manifest_path() {
+ @safe string manifest_path() {
return _manifested.pod_manifest_path;
}
- string pod_name_with_path() {
+ @safe string pod_name_with_path() {
return _manifested.pod_manifest_path.baseName;
}
- string manifest_file_with_path() {
+ @safe string manifest_file_with_path() {
return _manifested.pod_manifest_file_with_path;
}
- string[] config_dr_document_make_dirs() {
+ @safe string[] config_dr_document_make_dirs() {
string[] _config_dirs;
return _config_dirs;
}
- string[] config_local_site_dirs() {
+ @safe string[] config_local_site_dirs() {
string[] _config_dirs;
return _config_dirs;
}
- string[] image_dirs() {
+ @safe string[] image_dirs() {
string[] _image_dirs;
return _image_dirs;
}
- auto manifest_list_of_filenames() {
+ @safe auto manifest_list_of_filenames() {
return _manifest_fn_list;
}
- string[] manifest_list_of_languages() {
+ @safe string[] manifest_list_of_languages() {
string[] _lngs;
foreach (filename_; manifest_list_of_filenames) {
string _k = "en";
@@ -152,43 +152,43 @@ template PathMatters() {
}
return Pod_();
}
- auto src() {
+ @safe auto src() {
string _fns = _fns; // required here by dmd & not by ldc (for D:2078)
auto _opt_actions = _opt_actions;
auto _env = _env;
struct SRC_ {
- bool is_pod() {
+ @safe bool is_pod() {
return (_manifested.pod_manifest_path.length > 0) ? true : false;
}
- string path_and_fn() {
+ @safe string path_and_fn() {
return _fns;
}
- string pod_name_with_path() {
+ @safe string pod_name_with_path() {
return (is_pod) ? _manifested.pod_manifest_path : "";
}
- string pods_collection_root_path() {
+ @safe string pods_collection_root_path() {
return (is_pod) ? _manifested.pods_collection_root_path : "";
}
- string pod_name() {
+ @safe string pod_name() {
return pod_name_with_path.baseName;
}
- string filename() {
+ @safe string filename() {
return path_and_fn.baseName;
}
- string filename_base() {
+ @safe string filename_base() {
return filename.stripExtension;
}
- string filename_extension() {
+ @safe string filename_extension() {
return filename.match(rgx.src_pth_sst_or_ssm).captures["extension"];
}
- string lng() {
+ @safe string lng() {
string _k;
if (auto m = path_and_fn.match(rgx.language_code_and_filename)) {
_k = m.captures[1];
} else {_k = "en"; }
return _k;
}
- string doc_uid() {
+ @safe string doc_uid() {
string _uid;
if (is_pod && !(pod_name_with_path.empty)) {
if (pod_name_with_path.baseName == filename_base) {
@@ -201,7 +201,7 @@ template PathMatters() {
}
return _uid;
}
- string doc_uid_out() {
+ @safe string doc_uid_out() {
string _uid;
if (is_pod && !(pod_name_with_path.empty)) {
if (pod_name_with_path.baseName == filename_base) {
@@ -214,7 +214,7 @@ template PathMatters() {
}
return _uid;
}
- string docname_composite_unique_per_src_doc() {
+ @safe string docname_composite_unique_per_src_doc() {
string _fn;
if (pod_name_with_path.baseName == filename_base) {
_fn = filename_base ~ mkup.sep ~ filename_extension ~ mkup.sep ~ lng;
@@ -225,7 +225,7 @@ template PathMatters() {
}
return _fn;
}
- string docname_composite_unique_per_src_pod() {
+ @safe string docname_composite_unique_per_src_pod() {
/+
z pod name if any + src filename (without lng code)
filename ~ mkup.sep ~ lng
@@ -244,19 +244,19 @@ template PathMatters() {
}
return _fn;
}
- string language() {
+ @safe string language() {
return lng();
}
- string file_with_absolute_path() {
+ @safe string file_with_absolute_path() {
return _env["pwd"].chainPath(path_and_fn).array;
}
- string absolute_path_to_src() {
+ @safe string absolute_path_to_src() {
return (_env["pwd"].chainPath(path_and_fn)).dirName.array;
}
- string path_to_doc_root_path_to_lang_and_filename() {
+ @safe string path_to_doc_root_path_to_lang_and_filename() {
return _env["pwd"].chainPath(path_and_fn).array;
}
- string base_dir() {
+ @safe string base_dir() {
string _dir;
if (
auto m = (absolute_path_to_src)
@@ -274,7 +274,7 @@ template PathMatters() {
}
return _dir;
}
- string base_parent_dir_path() {
+ @safe string base_parent_dir_path() {
string _dir;
if (
auto m = (absolute_path_to_src)
@@ -286,7 +286,7 @@ template PathMatters() {
}
return _dir;
}
- string base_dir_path() {
+ @safe string base_dir_path() {
string _dir;
if (
auto m = (absolute_path_to_src)
@@ -306,11 +306,11 @@ template PathMatters() {
}
return _dir;
}
- string media_dir_path() {
+ @safe string media_dir_path() {
string _dir = ((base_dir_path.chainPath("media")).asNormalizedPath).array;
return _dir;
}
- string image_dir_path() {
+ @safe string image_dir_path() {
string _paths;
string[] _possible_img_pths = [ "./image", "../image", "../../image" ];
string _img_pth_found = "";
@@ -334,10 +334,10 @@ template PathMatters() {
}
return _img_pth_found;
}
- auto conf_dir_path() {
+ @safe auto conf_dir_path() {
return ((base_dir_path.chainPath("conf")).asNormalizedPath).array;
}
- auto base_parent_dir() {
+ @safe auto base_parent_dir() {
string _dir;
if (
auto m = (absolute_path_to_src)
@@ -352,13 +352,13 @@ template PathMatters() {
}
return _dir;
}
- string[] config_dirs() {
+ @safe string[] config_dirs() {
string[] _config_dirs;
if (is_pod) {
} else {}
return _config_dirs;
}
- string[] image_dirs() {
+ @safe string[] image_dirs() {
string[] _image_dirs;
if (is_pod) {
} else {}
@@ -367,7 +367,7 @@ template PathMatters() {
}
return SRC_();
}
- auto output() {
+ @safe auto output() {
/+
- command line if output path set
- config file if found and set set
@@ -381,7 +381,7 @@ template PathMatters() {
+/
auto _env = _env;
struct Out_ {
- auto path() {
+ @safe auto path() {
auto _output_path = _env["pwd"];
if ((_opt_actions.output_dir_set.length > 0)
&& isValidPath(_opt_actions.output_dir_set)
@@ -411,21 +411,21 @@ template PathMatters() {
template ConfigFilePaths() {
mixin spineRgxInit;
static auto rgx = Rgx();
- auto ConfigFilePaths(M,E)(
+ @safe auto ConfigFilePaths(M,E)(
M _manifested,
E _env,
string _cli_config_path_set = ""
) {
struct ConfFilePaths {
- string config_filename_document() {
+ @safe string config_filename_document() {
return "dr_document_make";
}
- string config_filename_site() {
+ @safe string config_filename_site() {
return "config_local_site";
}
- auto possible_config_path_locations() {
+ @safe auto possible_config_path_locations() {
struct _ConfFilePaths {
- string[] dr_document_make() {
+ @safe string[] dr_document_make() {
/+ FIX clean up conf paths ↓ +/
/+ config local site (file system only, not in pod) +/
/+ return paths +/
@@ -474,7 +474,7 @@ template ConfigFilePaths() {
+/
return _possible_config_path_locations;
}
- string[] config_local_site() {
+ @safe string[] config_local_site() {
/+ FIX clean up conf paths ↓ +/
/+ config local site (file system only, not in pod) +/
string[] _possible_config_path_locations;
@@ -533,15 +533,15 @@ template ConfigFilePaths() {
template spinePathsSRC() {
mixin spineRgxInit;
static auto rgx = Rgx();
- auto spinePathsSRC(D,Fn)(
+ @safe auto spinePathsSRC(D,Fn)(
D _pwd,
Fn _fn_src_and_path,
) {
struct drSrcPaths {
- auto pwd() {
+ @safe auto pwd() {
return _pwd;
}
- string language() {
+ @safe string language() {
// use command line info as well?
string _k;
if (auto m = _fn_src_and_path.match(rgx.language_code_and_filename)) {
@@ -551,28 +551,28 @@ template spinePathsSRC() {
}
return _k;
}
- string doc_root() {
+ @safe string doc_root() {
return "dr_doc";
}
- auto media_root() {
+ @safe auto media_root() {
return ((doc_root.chainPath("media")).asNormalizedPath).array;
}
- auto conf_root() {
+ @safe auto conf_root() {
return ((doc_root.chainPath("conf")).asNormalizedPath).array;
}
- auto text_root() {
+ @safe auto text_root() {
return ((media_root.chainPath("text")).asNormalizedPath).array;
}
- auto image_root() {
+ @safe auto image_root() {
return ((media_root.chainPath("image")).asNormalizedPath).array;
}
- auto doc_src_fn_with_path_for_text_root_and_lng() {
+ @safe auto doc_src_fn_with_path_for_text_root_and_lng() {
return ((text_root.chainPath(language)).asNormalizedPath).array;
}
- auto doc_src_fn() {
+ @safe auto doc_src_fn() {
return ((_fn_src_and_path.baseName).asNormalizedPath).array;
}
- auto doc_src_with_path() {
+ @safe auto doc_src_with_path() {
return ((pwd.chainPath(_fn_src_and_path)).asNormalizedPath).array;
}
}