aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/io_in
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc_reform/io_in')
-rw-r--r--src/doc_reform/io_in/paths_source.d132
-rw-r--r--src/doc_reform/io_in/read_config_files.d14
-rw-r--r--src/doc_reform/io_in/read_source_files.d24
3 files changed, 85 insertions, 85 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;
}
}
diff --git a/src/doc_reform/io_in/read_config_files.d b/src/doc_reform/io_in/read_config_files.d
index 1f6faa3..ce16f24 100644
--- a/src/doc_reform/io_in/read_config_files.d
+++ b/src/doc_reform/io_in/read_config_files.d
@@ -14,7 +14,7 @@ static template readConfigSite() {
std.file,
std.path;
mixin spineRgxInit;
- final auto readConfigSite(C)(C _conf_file_details) {
+ @system final auto readConfigSite(C)(C _conf_file_details) {
static auto rgx = Rgx();
string conf_filename = "NONE";
string config_file_str;
@@ -119,7 +119,7 @@ static template readConfigDoc() {
std.file,
std.path;
mixin spineRgxInit;
- final auto readConfigDoc(M,E)(M _manifested, E _env) {
+ @system final auto readConfigDoc(M,E)(M _manifested, E _env) {
static auto rgx = Rgx();
string config_file_str;
string conf_filename = "NONE";
@@ -146,13 +146,13 @@ static template readConfigDoc() {
if (config_file_str.length > 0) { break; }
}
struct _ConfContent {
- string filename() {
+ @safe string filename() {
return conf_filename;
}
- string content() {
+ @safe string content() {
return config_file_str;
}
- string filetype() {
+ @safe string filetype() {
string _ft = "";
if (content.match(rgx.yaml_config)) {
_ft = "yaml";
@@ -169,7 +169,7 @@ static template configReadSiteYAML() {
doc_reform.io_in.paths_source,
std.file,
std.path;
- final YAMLDocument configReadSiteYAML(M,E)(M _manifested, E _env) {
+ @safe final YAMLDocument configReadSiteYAML(M,E)(M _manifested, E _env) {
string _configuration = configReadInSiteYAML!()(_manifested, _env);
auto _conf_file_details = ConfigFilePaths!()(_manifested, _env);
string _conf_yaml_fn = _conf_file_details.config_filename_site;
@@ -183,7 +183,7 @@ static template configReadDocYAML() {
doc_reform.io_in.paths_source,
std.file,
std.path;
- final YAMLDocument configReadDocYAML(M,E)(M _manifested, E _env) {
+ @safe final YAMLDocument configReadDocYAML(M,E)(M _manifested, E _env) {
string _configuration = configReadInDocYAML!()(_manifested, _env);
auto _conf_file_details = ConfigFilePaths!()(_manifested, _env);
string _conf_yaml_fn = _conf_file_details.config_filename_document;
diff --git a/src/doc_reform/io_in/read_source_files.d b/src/doc_reform/io_in/read_source_files.d
index ba3e145..fcbd075 100644
--- a/src/doc_reform/io_in/read_source_files.d
+++ b/src/doc_reform/io_in/read_source_files.d
@@ -15,7 +15,7 @@ static template spineRawMarkupContent() {
mixin spineRgxInit;
static auto rgx = Rgx();
string[] _images=[];
- string[] _extract_images(S)(S content_block) @safe {
+ @safe string[] _extract_images(S)(S content_block) {
string[] images_;
string _content_block = content_block.to!string;
if (auto m = _content_block.matchAll(rgx.image)) {
@@ -35,19 +35,19 @@ static template spineRawMarkupContent() {
string[], "insert_files",
string[], "images"
);
- auto spineRawMarkupContent(O,Fn)(O _opt_action, Fn fn_src) @safe {
+ @safe auto spineRawMarkupContent(O,Fn)(O _opt_action, Fn fn_src) {
auto _0_header_1_body_content_2_insert_filelist_tuple
= rawsrc.sourceContentSplitIntoHeaderAndBody(_opt_action, rawsrc.sourceContent(fn_src), fn_src);
return _0_header_1_body_content_2_insert_filelist_tuple;
}
struct RawMarkupContent {
- final sourceContent(in string fn_src) {
+ @safe final sourceContent(in string fn_src) {
auto raw = MarkupRawUnit();
string source_txt_str
= raw.markupSourceReadIn(fn_src);
return source_txt_str;
}
- final auto sourceContentSplitIntoHeaderAndBody(O)(
+ @safe final auto sourceContentSplitIntoHeaderAndBody(O)(
O _opt_action,
in string source_txt_str,
in string fn_src=""
@@ -84,7 +84,7 @@ static template spineRawMarkupContent() {
}
struct MarkupRawUnit {
import std.file;
- final private string readInMarkupSource(in char[] fn_src) {
+ @safe final private string readInMarkupSource(in char[] fn_src) {
enforce(
exists(fn_src) != 0,
"file not found: «" ~
@@ -107,7 +107,7 @@ static template spineRawMarkupContent() {
std.utf.validate(source_txt_str);
return source_txt_str;
}
- final private char[][] header0Content1(in string src_text) @trusted { // cast(char[])
+ @trusted final private char[][] header0Content1(in string src_text) { // cast(char[])
/+ split string on _first_ match of "^:?A~\s" into [header, content] array/tuple +/
char[][] header_and_content;
auto m = (cast(char[]) src_text).matchFirst(rgx.heading_a);
@@ -120,12 +120,12 @@ static template spineRawMarkupContent() {
);
return header_and_content;
}
- final private char[][] markupSourceLineArray(in char[] src_text) @trusted { // cast(char[])
+ @trusted final private char[][] markupSourceLineArray(in char[] src_text) { // cast(char[])
char[][] source_line_arr
= (cast(char[]) src_text).split(rgx.newline_eol_strip_preceding);
return source_line_arr;
}
- string markupSourceReadIn(in string fn_src) {
+ @safe string markupSourceReadIn(in string fn_src) {
static auto rgx = Rgx();
enforce(
fn_src.match(rgx.src_pth_sst_or_ssm),
@@ -135,7 +135,7 @@ static template spineRawMarkupContent() {
string source_txt_str = readInMarkupSource(fn_src);
return source_txt_str;
}
- HeaderContentInsertsImages markupSourceHeaderContentRawLineTupleArray(in string source_txt_str) @safe {
+ @safe HeaderContentInsertsImages markupSourceHeaderContentRawLineTupleArray(in string source_txt_str) {
string[] file_insert_list = [];
string[] images_list = [];
char[][] hc = header0Content1(source_txt_str);
@@ -150,7 +150,7 @@ static template spineRawMarkupContent() {
);
return t;
}
- final char[][] getInsertMarkupSourceContentRawLineArray(
+ @safe final char[][] getInsertMarkupSourceContentRawLineArray(
in char[] fn_src_insert,
Regex!(char) rgx_file
) {
@@ -169,7 +169,7 @@ static template spineRawMarkupContent() {
char[][], "insert_contents",
string[], "images"
);
- ContentsAndImages scan_subdoc_source(O)(
+ @safe ContentsAndImages scan_subdoc_source(O)(
O _opt_action,
char[][] markup_sourcefile_insert_content,
string fn_src
@@ -254,7 +254,7 @@ static template spineRawMarkupContent() {
);
return t;
}
- ContentsInsertsImages scan_master_src_for_insert_files_and_import_content(O)(
+ @safe ContentsInsertsImages scan_master_src_for_insert_files_and_import_content(O)(
O _opt_action,
char[][] sourcefile_body_content,
string fn_src