From bdcb9189e4cf221bec1efaf2e6e612b127e51f25 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 6 Jan 2018 20:34:42 -0500 Subject: 0.23.3 work on source & target file paths/locations --- org/meta_read_source_files.org | 72 ++++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 31 deletions(-) (limited to 'org/meta_read_source_files.org') diff --git a/org/meta_read_source_files.org b/org/meta_read_source_files.org index 3c92560..a3a59a5 100644 --- a/org/meta_read_source_files.org +++ b/org/meta_read_source_files.org @@ -49,9 +49,13 @@ static template configInSite() { <> final string configInSite(M,E)(M manifest, E env) { auto conf_file_details = ConfigFilePaths!()(manifest, env); - string conf_sdl = conf_file_details.config_filename_site; - auto possible_config_path_locations = conf_file_details.possible_config_path_locations_local_site; + string conf_sdl = conf_file_details.possible_config_path_locations.config_filename_site; + auto possible_config_path_locations = conf_file_details.possible_config_path_locations.local_site; string config_file_str; + debug(io) { + writeln("in config filename: ", conf_sdl); + writeln("in config possible path locations: ", possible_config_path_locations); + } foreach(pth; possible_config_path_locations) { auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_sdl)).array; if (config_file_str.length > 0) { @@ -59,8 +63,8 @@ static template configInSite() { } try { if (exists(conf_file)) { - debug(configfile) { - writeln(conf_file); + debug(io) { + writeln("in config file found: ", conf_file); } config_file_str = conf_file.readText; break; @@ -83,8 +87,12 @@ static template configInDoc() { final string configInDoc(M,E)(M manifest, E env) { auto conf_file_details = ConfigFilePaths!()(manifest, env); string conf_sdl = conf_file_details.config_filename_document; - auto possible_config_path_locations = conf_file_details.possible_config_path_locations_document; + auto possible_config_path_locations = conf_file_details.possible_config_path_locations.document; string config_file_str; + debug(io) { + writeln("in config filename: ", conf_sdl); + writeln("in config possible path locations: ", possible_config_path_locations); + } foreach(pth; possible_config_path_locations) { auto conf_file = asNormalizedPath(chainPath(to!string(pth), conf_sdl)).array; if (config_file_str.length > 0) { @@ -92,8 +100,8 @@ static template configInDoc() { } try { if (exists(conf_file)) { - debug(configfile) { - writeln(conf_file); + debug(io) { + writeln("in config file found: ", conf_file); } config_file_str = conf_file.readText; break; @@ -159,13 +167,13 @@ static template configReadDoc() { } #+END_SRC -*** config hub import sdlang +*** config hub _import sdlang_ #+name: meta_config_file_import_mixin #+BEGIN_SRC d import sdlang; #+END_SRC -*** config hub function +*** config hub function read makes for site & doc Read in sdl config file name given, and return sdl root @@ -174,7 +182,7 @@ Read in sdl config file name given, and return sdl root final auto configReadSite(M,E)(M manifest, E env) { auto configuration = configInSite!()(manifest, env); auto conf_file_details = ConfigFilePaths!()(manifest, env); - string conf_sdl = conf_file_details.config_filename_site; + string conf_sdl = conf_file_details.possible_config_path_locations.config_filename_site; auto sdl_root = ConfigSDLang!()(configuration, conf_sdl); return sdl_root; } @@ -218,37 +226,37 @@ static template SiSUrawMarkupContent() { } auto rawsrc = RawMarkupContent(); auto SiSUrawMarkupContent(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); + 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) { auto raw = MarkupRawUnit(); - auto source_txt_str = - raw.markupSourceReadIn(fn_src); + auto source_txt_str + = raw.markupSourceReadIn(fn_src); return source_txt_str; } final auto sourceContentSplitIntoHeaderAndBody(O)(O _opt_action, in string source_txt_str, in string fn_src="") { auto raw = MarkupRawUnit(); string[] insert_file_list; string[] images_list; - auto t = - raw.markupSourceHeaderContentRawLineTupleArray(source_txt_str); + auto t + = raw.markupSourceHeaderContentRawLineTupleArray(source_txt_str); auto header_raw = t[0]; auto sourcefile_body_content = t[1]; if (fn_src.match(rgx.src_fn_master)) { // filename with path needed if master file (.ssm) not otherwise auto ins = Inserts(); - auto tu = - ins.scan_master_src_for_insert_files_and_import_content(_opt_action, sourcefile_body_content, fn_src); + auto tu + = ins.scan_master_src_for_insert_files_and_import_content(_opt_action, sourcefile_body_content, fn_src); static assert(!isTypeTuple!(tu)); sourcefile_body_content = tu[0]; insert_file_list = tu[1].dup; images_list = tu[2].dup; } else if (_opt_action.source || _opt_action.sisupod) { auto ins = Inserts(); - auto tu = - ins.scan_master_src_for_insert_files_and_import_content(_opt_action, sourcefile_body_content, fn_src); + auto tu + = ins.scan_master_src_for_insert_files_and_import_content(_opt_action, sourcefile_body_content, fn_src); static assert(!isTypeTuple!(tu)); images_list = tu[2].dup; } @@ -316,6 +324,9 @@ final private string readInMarkupSource(in char[] fn_src) { string source_txt_str; try { if (exists(fn_src)) { + debug(io) { + writeln("in src, markup source file found: ", fn_src); + } source_txt_str = fn_src.readText; } } @@ -334,7 +345,6 @@ final private string readInMarkupSource(in char[] fn_src) { **** notes source_txt_str = readText(fn_src); // ok - catch (ErrnoException ex) { } @@ -365,8 +375,8 @@ final private char[][] header0Content1(in string src_text) { #+name: meta_markup_source_raw_source_line_array #+BEGIN_SRC d final private char[][] markupSourceLineArray(in char[] src_text) { - char[][] source_line_arr = - (cast(char[]) src_text).split(rgx.newline_eol_strip_preceding); + char[][] source_line_arr + = (cast(char[]) src_text).split(rgx.newline_eol_strip_preceding); return source_line_arr; } #+END_SRC @@ -495,11 +505,11 @@ if (type1["curly_code"] == 1) { type1["header_meta"] = 0; auto insert_fn = m.captures[2]; auto insert_sub_pth = m.captures[1]; - auto fn_src_insert = - chainPath(markup_src_file_path, insert_sub_pth ~ insert_fn).array; + auto fn_src_insert + = chainPath(markup_src_file_path, insert_sub_pth ~ insert_fn).array; auto raw = MarkupRawUnit(); - auto markup_sourcesubfile_insert_content = - raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx.src_fn_find_inserts); + auto markup_sourcesubfile_insert_content + = raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx.src_fn_find_inserts); debug(insert_file) { tell_l("red", line); tell_l("red", fn_src_insert); @@ -584,8 +594,8 @@ if (type["curly_code"] == 1) { } else if (auto m = line.match(rgx.insert_src_fn_ssi_or_sst)) { auto insert_fn = m.captures[2]; auto insert_sub_pth = m.captures[1]; - auto fn_src_insert = - chainPath(markup_src_file_path, insert_sub_pth ~ insert_fn).array; + auto fn_src_insert + = chainPath(markup_src_file_path, insert_sub_pth ~ insert_fn).array; insert_file_list ~= to!string(fn_src_insert); auto raw = MarkupRawUnit(); /+ TODO +/ @@ -593,8 +603,8 @@ if (type["curly_code"] == 1) { /+ .sst when inserted, not used: headers and heading level ^:?A~ so remove +/ writeln(__LINE__); writeln(ma); } - auto markup_sourcefile_insert_content = - raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx.src_fn_find_inserts); + auto markup_sourcefile_insert_content + = raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx.src_fn_find_inserts); debug(insert_file) { tell_l("red", line); tell_l("red", fn_src_insert); -- cgit v1.2.3