diff options
Diffstat (limited to 'org/default_paths.org')
-rw-r--r-- | org/default_paths.org | 134 |
1 files changed, 68 insertions, 66 deletions
diff --git a/org/default_paths.org b/org/default_paths.org index 009770d..9e9770f 100644 --- a/org/default_paths.org +++ b/org/default_paths.org @@ -30,6 +30,7 @@ meta_config_files.d +/ module doc_reform.io_in.paths_source; +@safe: import std.array, std.file, @@ -56,7 +57,7 @@ import template PodManifest() { mixin spineRgxFiles; static auto rgx_files = RgxFiles(); - @safe auto PodManifest(O)( + auto PodManifest(O)( O _opt_action, string _pth="" ) { @@ -64,7 +65,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 @@ -86,10 +87,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; @@ -133,14 +134,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; @@ -154,7 +155,7 @@ template PathMatters() { } return Env_(); } - @safe auto opt() { + auto opt() { struct Opt_ { auto action() { return _opt_action; @@ -162,45 +163,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"; @@ -214,43 +215,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) { @@ -263,7 +264,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) { @@ -276,7 +277,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; @@ -287,7 +288,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 @@ -306,19 +307,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) @@ -336,7 +337,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) @@ -348,7 +349,7 @@ template PathMatters() { } return _dir; } - @safe string base_dir_path() { + string base_dir_path() { string _dir; if ( auto m = (absolute_path_to_src) @@ -368,11 +369,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 = ""; @@ -396,10 +397,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) @@ -414,13 +415,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 {} @@ -429,7 +430,7 @@ template PathMatters() { } return SRC_(); } - @safe auto output() { + auto output() { /+ - command line if output path set - config file if found and set set @@ -443,7 +444,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) @@ -477,21 +478,21 @@ template PathMatters() { #+NAME: template_paths_src_2 #+BEGIN_SRC d 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 +/ @@ -539,7 +540,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; @@ -650,15 +651,15 @@ filelist for processing [things to ponder] 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)) { @@ -668,28 +669,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; } } @@ -972,6 +973,7 @@ template spinePathsPods() { default settings +/ module doc_reform.io_out.paths_output; +@safe: import std.array, std.path, |