aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/io_in/paths_source.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2024-03-12 22:39:09 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2024-03-12 22:56:34 -0400
commite9e17be24eba558c30fcdc41ea5bb9a1da7fd4e7 (patch)
tree1ed3c4b528b0a8e54d0eb9babc391e562578c7b4 /src/doc_reform/io_in/paths_source.d
parentnix flake & env upkeep (diff)
mark modules as @safe: (& identify what is not)
Diffstat (limited to 'src/doc_reform/io_in/paths_source.d')
-rw-r--r--src/doc_reform/io_in/paths_source.d133
1 files changed, 67 insertions, 66 deletions
diff --git a/src/doc_reform/io_in/paths_source.d b/src/doc_reform/io_in/paths_source.d
index 2bb5c4d..8d12f98 100644
--- a/src/doc_reform/io_in/paths_source.d
+++ b/src/doc_reform/io_in/paths_source.d
@@ -53,6 +53,7 @@
meta_config_files.d
+/
module doc_reform.io_in.paths_source;
+@safe:
import
std.array,
std.file,
@@ -66,7 +67,7 @@ import
template PodManifest() {
mixin spineRgxFiles;
static auto rgx_files = RgxFiles();
- @safe auto PodManifest(O)(
+ auto PodManifest(O)(
O _opt_action,
string _pth=""
) {
@@ -74,7 +75,7 @@ template PodManifest() {
string pod_manifest_filename() {
return "pod.manifest";
}
- @safe string pod_manifest_path() {
+ string pod_manifest_path() {
string _manifest_path;
if ((isValidPath(_pth) && exists(_pth) != 0 && _pth.isDir)
&& (exists(_pth.chainPath(pod_manifest_filename).array) != 0
@@ -96,10 +97,10 @@ template PodManifest() {
}
return _manifest_path;
}
- @safe string pods_collection_root_path() {
+ string pods_collection_root_path() {
return (pod_manifest_path.length > 0) ? ((chainPath(pod_manifest_path, "..")).asNormalizedPath).array.to!string : "";
}
- @safe string pod_manifest_file_with_path() {
+ 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;
@@ -121,14 +122,14 @@ template PathMatters() {
mixin spineRgxFiles;
static auto rgx_files = RgxFiles();
static auto mkup = InlineMarkup();
- @safe auto PathMatters(O,E)(
+ auto PathMatters(O,E)(
O _opt_action,
E _env,
string _pth,
string _fns = "",
char[][] _manifest_fn_list = [[]],
) {
- @safe auto _manifested = PodManifest!()(_opt_action, _pth);
+ auto _manifested = PodManifest!()(_opt_action, _pth);
struct ManifestMatters_ {
auto env() {
auto _env = _env;
@@ -142,7 +143,7 @@ template PathMatters() {
}
return Env_();
}
- @safe auto opt() {
+ auto opt() {
struct Opt_ {
auto action() {
return _opt_action;
@@ -150,45 +151,45 @@ template PathMatters() {
}
return Opt_();
}
- @safe bool src_is_pod() {
+ bool src_is_pod() {
return (_manifested.pod_manifest_path.length > 0) ? true : false;
}
- @safe auto pod() {
+ auto pod() {
struct Pod_ {
- @safe bool src_is_pod() {
+ bool src_is_pod() {
return (_manifested.pod_manifest_path.length > 0) ? true : false;
}
- @safe string collection_root() {
+ string collection_root() {
return _manifested.pods_collection_root_path;
}
- @safe string manifest_filename() {
+ string manifest_filename() {
return _manifested.pod_manifest_filename;
}
- @safe string manifest_path() {
+ string manifest_path() {
return _manifested.pod_manifest_path;
}
- @safe string pod_name_with_path() {
+ string pod_name_with_path() {
return _manifested.pod_manifest_path.baseName;
}
- @safe string manifest_file_with_path() {
+ string manifest_file_with_path() {
return _manifested.pod_manifest_file_with_path;
}
- @safe string[] config_dr_document_make_dirs() {
+ string[] config_dr_document_make_dirs() {
string[] _config_dirs;
return _config_dirs;
}
- @safe string[] config_local_site_dirs() {
+ string[] config_local_site_dirs() {
string[] _config_dirs;
return _config_dirs;
}
- @safe string[] image_dirs() {
+ string[] image_dirs() {
string[] _image_dirs;
return _image_dirs;
}
- @safe auto manifest_list_of_filenames() {
+ auto manifest_list_of_filenames() {
return _manifest_fn_list;
}
- @safe string[] manifest_list_of_languages() {
+ string[] manifest_list_of_languages() {
string[] _lngs;
foreach (filename_; manifest_list_of_filenames) {
string _k = "en";
@@ -202,43 +203,43 @@ template PathMatters() {
}
return Pod_();
}
- @safe auto src() {
+ auto src() {
string _fns = _fns; // required here by dmd & not by ldc (for D:2078)
auto _opt_action = _opt_action;
auto _env = _env;
struct SRC_ {
- @safe bool is_pod() {
+ bool is_pod() {
return (_manifested.pod_manifest_path.length > 0) ? true : false;
}
- @safe string path_and_fn() {
+ string path_and_fn() {
return _fns;
}
- @safe string pod_name_with_path() {
+ string pod_name_with_path() {
return (is_pod) ? _manifested.pod_manifest_path : "";
}
- @safe string pods_collection_root_path() {
+ string pods_collection_root_path() {
return (is_pod) ? _manifested.pods_collection_root_path : "";
}
- @safe string pod_name() {
+ string pod_name() {
return pod_name_with_path.baseName;
}
- @safe string filename() {
+ string filename() {
return path_and_fn.baseName;
}
- @safe string filename_base() {
+ string filename_base() {
return filename.stripExtension;
}
- @safe string filename_extension() {
+ string filename_extension() {
return filename.match(rgx_files.src_pth_sst_or_ssm).captures["extension"];
}
- @safe string lng() {
+ string lng() {
string _k;
if (auto m = path_and_fn.match(rgx_files.language_code_and_filename)) {
_k = m.captures[1];
} else {_k = "en"; }
return _k;
}
- @safe string doc_uid() {
+ string doc_uid() {
string _uid;
if (is_pod && !(pod_name_with_path.empty)) {
if (pod_name_with_path.baseName == filename_base) {
@@ -251,7 +252,7 @@ template PathMatters() {
}
return _uid;
}
- @safe string doc_uid_out() {
+ string doc_uid_out() {
string _uid;
if (is_pod && !(pod_name_with_path.empty)) {
if (pod_name_with_path.baseName == filename_base) {
@@ -264,7 +265,7 @@ template PathMatters() {
}
return _uid;
}
- @safe string docname_composite_unique_per_src_doc() {
+ string docname_composite_unique_per_src_doc() {
string _fn;
if (pod_name_with_path.baseName == filename_base) {
_fn = filename_base ~ mkup.uid_sep ~ filename_extension ~ mkup.uid_sep ~ lng;
@@ -275,7 +276,7 @@ template PathMatters() {
}
return _fn;
}
- @safe string docname_composite_unique_per_src_pod() {
+ string docname_composite_unique_per_src_pod() {
/+
z pod name if any + src filename (without lng code)
filename ~ mkup.uid_sep ~ lng
@@ -294,19 +295,19 @@ template PathMatters() {
}
return _fn;
}
- @safe string language() {
+ string language() {
return lng();
}
- @safe string file_with_absolute_path() {
+ string file_with_absolute_path() {
return _env["pwd"].chainPath(path_and_fn).array;
}
- @safe string absolute_path_to_src() {
+ string absolute_path_to_src() {
return (_env["pwd"].chainPath(path_and_fn)).dirName.array;
}
- @safe string path_to_doc_root_path_to_lang_and_filename() {
+ string path_to_doc_root_path_to_lang_and_filename() {
return _env["pwd"].chainPath(path_and_fn).array;
}
- @safe string base_dir() {
+ string base_dir() {
string _dir;
if (
auto m = (absolute_path_to_src)
@@ -324,7 +325,7 @@ template PathMatters() {
}
return _dir;
}
- @safe string base_parent_dir_path() {
+ string base_parent_dir_path() {
string _dir;
if (
auto m = (absolute_path_to_src)
@@ -336,7 +337,7 @@ template PathMatters() {
}
return _dir;
}
- @safe string base_dir_path() {
+ string base_dir_path() {
string _dir;
if (
auto m = (absolute_path_to_src)
@@ -356,11 +357,11 @@ template PathMatters() {
}
return _dir;
}
- @safe string media_dir_path() {
+ string media_dir_path() {
string _dir = ((base_dir_path.chainPath("media")).asNormalizedPath).array;
return _dir;
}
- @safe string image_dir_path() {
+ string image_dir_path() {
string _paths;
string[] _possible_img_pths = [ "./image", "../image", "../../image" ];
string _img_pth_found = "";
@@ -384,10 +385,10 @@ template PathMatters() {
}
return _img_pth_found;
}
- @safe auto conf_dir_path() {
+ auto conf_dir_path() {
return ((base_dir_path.chainPath("conf")).asNormalizedPath).array;
}
- @safe auto base_parent_dir() {
+ auto base_parent_dir() {
string _dir;
if (
auto m = (absolute_path_to_src)
@@ -402,13 +403,13 @@ template PathMatters() {
}
return _dir;
}
- @safe string[] config_dirs() {
+ string[] config_dirs() {
string[] _config_dirs;
if (is_pod) {
} else {}
return _config_dirs;
}
- @safe string[] image_dirs() {
+ string[] image_dirs() {
string[] _image_dirs;
if (is_pod) {
} else {}
@@ -417,7 +418,7 @@ template PathMatters() {
}
return SRC_();
}
- @safe auto output() {
+ auto output() {
/+
- command line if output path set
- config file if found and set set
@@ -431,7 +432,7 @@ template PathMatters() {
+/
auto _env = _env;
struct Out_ {
- @safe auto path() {
+ auto path() {
auto _output_path = _env["pwd"];
if ((_opt_action.output_dir_set.length > 0)
&& isValidPath(_opt_action.output_dir_set)
@@ -459,21 +460,21 @@ template PathMatters() {
}
}
template configFilePaths() {
- @safe auto configFilePaths(M,E)(
+ auto configFilePaths(M,E)(
M _manifested,
E _env,
string _cli_config_path_set = ""
) {
struct ConfFilePaths {
- @safe string config_filename_document() {
+ string config_filename_document() {
return "dr_document_make";
}
- @safe string config_filename_site() {
+ string config_filename_site() {
return "config_local_site";
}
- @safe auto possible_config_path_locations() {
+ auto possible_config_path_locations() {
struct _ConfFilePaths {
- @safe string[] dr_document_make() {
+ string[] dr_document_make() {
/+ FIX clean up conf paths ↓ +/
/+ config local site (file system only, not in pod) +/
/+ return paths +/
@@ -521,7 +522,7 @@ template configFilePaths() {
+/
return _possible_config_path_locations;
}
- @safe string[] config_local_site() {
+ string[] config_local_site() {
/+ FIX clean up conf paths ↓ +/
/+ config local site (file system only, not in pod) +/
string[] _possible_config_path_locations;
@@ -580,15 +581,15 @@ template configFilePaths() {
template spinePathsSRC() {
mixin spineRgxFiles;
static auto rgx_files = RgxFiles();
- @safe auto spinePathsSRC(D,Fn)(
+ auto spinePathsSRC(D,Fn)(
D _pwd,
Fn _fn_src_and_path,
) {
struct drSrcPaths {
- @safe auto pwd() {
+ auto pwd() {
return _pwd;
}
- @safe string language() {
+ string language() {
// use command line info as well?
string _k;
if (auto m = _fn_src_and_path.match(rgx_files.language_code_and_filename)) {
@@ -598,28 +599,28 @@ template spinePathsSRC() {
}
return _k;
}
- @safe string doc_root() {
+ string doc_root() {
return "dr_doc";
}
- @safe auto media_root() {
+ auto media_root() {
return ((doc_root.chainPath("media")).asNormalizedPath).array;
}
- @safe auto conf_root() {
+ auto conf_root() {
return ((doc_root.chainPath("conf")).asNormalizedPath).array;
}
- @safe auto text_root() {
+ auto text_root() {
return ((media_root.chainPath("text")).asNormalizedPath).array;
}
- @safe auto image_root() {
+ auto image_root() {
return ((media_root.chainPath("image")).asNormalizedPath).array;
}
- @safe auto doc_src_fn_with_path_for_text_root_and_lng() {
+ auto doc_src_fn_with_path_for_text_root_and_lng() {
return ((text_root.chainPath(language)).asNormalizedPath).array;
}
- @safe auto doc_src_fn() {
+ auto doc_src_fn() {
return ((_fn_src_and_path.baseName).asNormalizedPath).array;
}
- @safe auto doc_src_with_path() {
+ auto doc_src_with_path() {
return ((pwd.chainPath(_fn_src_and_path)).asNormalizedPath).array;
}
}